java - TimeZone ID coming incorrectly daylight time -
can please explain this?
timezone tz1 = timezone.gettimezone(“cst”); ==> id of tz1 cst timezone tz2 = timezone.gettimezone(“cdt”); ==> id of tz2 gmt ????
for me following test code produces "not found => cdt":
for (string tz : timezone.getavailableids()) { if (tz.equals("cdt")) { system.out.println("found: " + tz); } } system.out.println("not found => cdt"); that means java.util.timezone fall non-existing cdt zone "gmt" documented:
returns: specified timezone, or gmt zone if given id cannot understood.
in java 8 have alternative of zoneid has not unintuitive fallback behaviour instead throwing zonerulesexception consider better.
Comments
Post a Comment