简体   繁体   中英

Java TimeZone.setDefault

TimeZone.setDefault timezone doesn't seem to support daylight savings time. If I leave the default (without using the function setDefault ) the application comes up displaying dates in EST/EDT. But if ever I want to change the time zone (I use a combo box of TimeZone.getAvailableIDs() ), I can only select EST (and daylight savings is ignored).

Looking in the documentation there's all sorts of ways to determine daylight savings of a timezone, but it doesn't look like it can be set. Any ideas how I can force a timezone to use daylight savings?

You can use daylight savings by referring to times when daylight savings is active.

The only way to tell it you want daylight savings even when it is not daylight savings is to create your own TimeZone, but that doesn't sound like a good idea. Or you can use a timezone which has the time offset you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM