aspose file tools*
The moose likes Java in General and the fly likes Converting a date object from GMT to EST Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Converting a date object from GMT to EST" Watch "Converting a date object from GMT to EST" New topic
Author

Converting a date object from GMT to EST

B.Sathish
Ranch Hand

Joined: Aug 18, 2005
Posts: 372
I have a couple of requirements

1. I have a Date object that represents the date and time in GMT. I need to be able to convert this into a date object that represents the equivalent EST time, Daylight savings need to be taken into account

2. I also need to convert a Date object representing the EST time into a Date object that represents the corresponding GMT time again taking into account Daylight savings.

I cannot rely on a constant difference between GMT and EST because daylight saving happens only in EST. I have tried out using the TimeZone, DateFormat and Calendar APIs, but I have not been successful.

Can someone help me with the code for doing this?

Thanks.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
A java.util.Date always represents a time in UT/GMT (they're the same, to all practical purposes) internally. But a java.util.Date is not the way to exchange date/time information with a user or another system (unless it uses UT). Look at Calendar, TimeZone and DateFormat for that.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Converting a date object from GMT to EST