*
The moose likes Java in General and the fly likes Time Zone Z associated with date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Time Zone Z associated with date" Watch "Time Zone Z associated with date" New topic
Author

Time Zone Z associated with date

prince davies
Ranch Hand

Joined: May 08, 2009
Posts: 74
IN xsd date is represented like <endDateTime>2011-08-02Z</endDateTime>

if you look closer you see "z" associated with the date.



When i use format method to get string ,it will return me correct data.
but when i convert date string to date ,it returns me wrong date ,

format = August 2, 2011
parse = august 01.2011

how do i resolve this issue?
prince davies
Ranch Hand

Joined: May 08, 2009
Posts: 74
i need this method should return date object and date should be standardized one or it should be accordance with the date stored in database (time zone)
prince davies
Ranch Hand

Joined: May 08, 2009
Posts: 74

public String formatGMTDate(Date date) {

String result = " ";
if (date != null) {
SimpleDateFormat gmtFormat = new SimpleDateFormat(DATE_FORMAT, getLocale());
TimeZone gmtTime = TimeZone.getTimeZone("GMT");
gmtFormat.setTimeZone(gmtTime);
result = gmtFormat.format(date);
}
return result;
}[/code]

or
 
 
subject: Time Zone Z associated with date
 
Similar Threads
Formatting date having month and year
Max Date Limit
Assigning jsonobject to java class having one to many relationship
dates between two dates
DateFormat problem