*
The moose likes Java in General and the fly likes how to get user defined timezone using XMLGregorianCalendar. 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 "how to get user defined timezone using XMLGregorianCalendar." Watch "how to get user defined timezone using XMLGregorianCalendar." New topic
Author

how to get user defined timezone using XMLGregorianCalendar.

rajashree loganayagi
Greenhorn

Joined: Apr 12, 2011
Posts: 20
Hi,

I have a string 'date' with a value "2011-08-10T00:00:00-06:00"(Format:yyyy-MM-dd'T'HH:mm:ss+timezone). My requirement is to parse the string into the XMLGregorianCalendar where i cannot able to parse the timezone values(-06:00). It throws "NumberFormatException".

Please suggest any solution.



Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

How are you doing the parsing? Note that SimpleDateFormat does not support the ISO 8601 format that's the standard for XML properly.

This works:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
rajashree loganayagi
Greenhorn

Joined: Apr 12, 2011
Posts: 20
I done the parsing using SimpleDateFormat. After using your code it works fine now.

Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get user defined timezone using XMLGregorianCalendar.
 
Similar Threads
Date, Calendar and TimeZones
How to add JAXB customization to a particular element of an xsd?
Parsing XML datetime in Android
how to set 2011-11-06T14:34:16.679+02:00 into XMLGregorianCalendar
Handling a strange date format