• 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

How to convert time zones

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like to know how we can convert the Time zone from EST to EDT with the time being saved for the dayLight changes.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't convert; you format. Here's an example:


[ February 20, 2006: Message edited by: Joni Salonen ]
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic