• Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting XMLGregorianCalendar to Calendar with timeZone information  RSS feed

 
Jagadeesh Balasubramanian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the best way to convert XMLGregorianCalendar to Calendar with timezone information.
I have been doing like this so far. I need to do this because I need to compare dates in my code.

The app works on Dallas (CDT/CST) time. Now the xmlCalendar.getTimezone() is shown as -360.
At times the server is not able to convert this -360 to CST and hence the above code converts the time wrongly to GMT.
What's the best way to avoid this? Can I do -1 * xmlCalendar.getTimezone(), create a Calender for GMT timezone and add the multiplied figure?


 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XmlGregorianCalandear does provide a toGregorianCalendar() method that allows you to specify a TimeZone and Locale.
Have you tried that?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!