File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to convert time zones Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to convert time zones" Watch "How to convert time zones" New topic
Author

How to convert time zones

yuvaraja ram
Greenhorn

Joined: Jan 18, 2006
Posts: 5
I like to know how we can convert the Time zone from EST to EDT with the time being saved for the dayLight changes.
Joni Salonen
Ranch Hand

Joined: Jan 07, 2006
Posts: 53
You don't convert; you format. Here's an example:


[ February 20, 2006: Message edited by: Joni Salonen ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18155
    
    8

Also, if you mean "Eastern Standard Time" and "Eastern Daylight Time" then they are the same time zone and no conversion is necessary. It doesn't make sense to ask for a time to be formatted as if it were daylight saving time, if it isn't.
yuvaraja ram
Greenhorn

Joined: Jan 18, 2006
Posts: 5
Thanks,

I had tried like what you had described but it is displaying GMT as its time zone when we set the TimeZone in the code "df.setTimeZone(TimeZone.getTimeZone("EDT"));" My requirement is to display the time zone as EDT always without any loss of time.
Joni Salonen
Ranch Hand

Joined: Jan 07, 2006
Posts: 53
getTimeZone returns UTC when the parameter you pass to it is not the name of a time zone. What exactly is "EDT"? Does it have daylight savings time?

You could check out the SimpleTimeZone class; with it you can create a TimeZone object with any offset and daylight savings time rules you want.

http://java.sun.com/j2se/1.5.0/docs/api/java/util/SimpleTimeZone.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to convert time zones
 
Similar Threads
TimeZone Conversion Example
how to convert String into Date format
how to convert string to int in jsp?
Epoch to groovy date
How to convert Long Time to Time/Date