• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Converting XMLGregorianCalendar to Calendar with timeZone information

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XmlGregorianCalandear does provide a toGregorianCalendar() method that allows you to specify a TimeZone and Locale.
Have you tried that?
 
See where your hand is? Not there. It's next to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic