java - How is timezone EST different from EST5EDT? -
this question has answer here:
- joda time datetimezone 2 answers
how different est est5edt ? isn't est take account dst?
i wrote small java snippet figure out difference , output says est5edt takes in account dst while est not
simpledateformat dateformat = new simpledateformat("yyyy-mmm-dd hh:mm:ss.sss"); dateformat.settimezone(timezone.gettimezone("est5edt")); system.out.println("est5edt" +dateformat.format(new date())); /* prints est5edt2013-apr-05 02:24:16.471 */ dateformat = new simpledateformat("yyyy-mmm-dd hh:mm:ss.sss"); dateformat.settimezone(timezone.gettimezone("est")); system.out.println("est "+dateformat.format(new date())); /*prints est 2013-apr-05 01:24:16.472 */
but below snippet produced shocking output
system.out.println("est5edt offset "+timezone.gettimezone("est5edt").getrawoffset()/(60*60*1000)); /* prints 5 instead of 4 (dst) */
could please explain happening here ? why getrawoffset returning 5 instead of 4 ? how timezone offset dst?
isn't est take account dst?
no. definition est "eastern standard time" or utc-5:00.
edt "eastern daylight time" or utc-4:00.
it's bit confusing, because example, new york switches between est , edt, , seattle switches between pst , pdt.
sometimes people incorrectly "i'll call 1pm est" when mean say, " i'll call 1pm eastern time" takes account whether or not it's daylight savings.
this wikipage has little more information.
why getrawoffset returning 5 instead of 4
timezone.getrawoffset returns number of milliseconds standard time, 5 * (60 * 60 * 1000)
since utc offset changes based of day of year (to account dst), you'll need use getoffset, , supply date want use.
Comments
Post a Comment