• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

GregorianCalendar is 8 hours too late

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to convert a UTC date to this format "MM/dd/yyyy HH:mm:ss". I have written the following algorithm to convert the date to a GregorianCalendar. I can then use the SimpleDateFormat to format the date as above. However, the time of the date is eight hours past when it should be. For example, "127317817092943762" converts to "06/15/2004 17:1:49" when it should convert to "06/15/2002 09:01". I added a line to set the TimeZone to Central Time Zone since we are in the midwest; however, this didn't impact the result. Any ideas?


[ June 21, 2004: Message edited by: verduka fox ]
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Verduka,

check the following URL: http://www.theserverside.net/discussions/thread.tss?thread_id=25524 on parsing a UTC date!

Hope this helps!
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

Perhaps the original date is not in UTC format. I need to translate "127310819640982810" to "06/07/2004 06:39". When I try to do so using the algorithm above, it is several hours off. Do you have another suggestion?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic