aspose file tools
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
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply 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
Bartender

Joined: Aug 16, 2005
Posts: 12956
    
    3

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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to get user defined timezone using XMLGregorianCalendar.
 
Similar Threads
how to set 2011-11-06T14:34:16.679+02:00 into XMLGregorianCalendar
Date, Calendar and TimeZones
Handling a strange date format
Parsing XML datetime in Android
How to add JAXB customization to a particular element of an xsd?