Reputation: 117
TimeZone timeZone = TimeZone.getTimeZone("US/Eastern");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd kk:mm z");
Date date=new Date();
formatter.setTimeZone(timeZone);
System.out.println(timeZone.getDisplayName());
System.out.println(formatter.format(date));
the output on my system is :
Eastern Standard Time
2015-04-01 02:41 EDT
I was expecting :
Eastern Standard Time
2015-04-01 02:41 EST
because US/Eastern is EST. can anyone explain me why?
Upvotes: 1
Views: 85
Reputation: 96
It's because of the daylight saving during summer.
U.S. states using EDT in the summer and EST in the winter. 1
Upvotes: 1
Reputation: 20658
The EDT (Eastern Daylight Time) is the daylight saving time zone coupled to EST (Eastern Standard Time). See Eastern Time Zone.
So you are getting a correct output.
Upvotes: 2
Reputation: 80
That's Eastern Daylight Time. To save an hour of daylight an hour is subtracted from the current time. As you can see the times are the same. This means that EST was updated automatically. In short, it's basically the same thing, do not worry.
See this short encyclopedia article.
Upvotes: 3