• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How can I get daylight saving time rule?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, there:

In JDK, is there any straightforward way to get daylight saving time rule for a particular timezone, like start(end) date, start(end) time? Yes, as someone said, I can print out timezone (ex. System.out.println(myTimeZone)) like:
java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dst
Savings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1, ..............]
My question is: besides besides parsing above timezone output string, is there any other method in JDK I can use to get those information? Highly appreciated if anyone can give me any suggestion.


Thanks a lot in advance

David
 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SimpleTimeZone:

http://java.sun.com/j2se/1.3/docs/api/java/util/SimpleTimeZone.html
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer the question that was actually asked - no, I don't think there is. The API doesn't seem to provide any way to get the info you want. As far as parsing is concerned - to make this easier (a little, maybe) you might try using XStream to write an XML representation of each instance. Might be a little easier to read & parse. Still not what you wanted, I imagine, but I don't see a better alternative.
 
reply
    Bookmark Topic Watch Topic
  • New Topic