在日历实例时区中添加日期在android中从EST更改为EDT

时间:2014-06-23 06:43:20

标签: java android

我在日历实例中添加日期以检查dst,同时添加日期,例如08-03-2014至09-03-2014时区从EST到EDT。白天的时间是假的。

TimeZone tz = TimeZone.getTimeZone("us/alaska");
Calendar c = Calendar.getInstance();
c.setTimeZone(tz);             

c.add(Calendar.DAY_OF_MONTH, 1);
checkDayLightTime = tz.inDaylightTime(c.getTime());
System.out.println("current get time"+c.getTime());
System.out.println("checkDayLightTime"+checkDayLightTime);    

03-08 02:59:58.505: INFO/System.out(12092): current get timeSun Mar 09 03:59:58 EDT 2014
03-08 02:59:58.505: INFO/System.out(12092): checkDayLightTimefalse

1 个答案:

答案 0 :(得分:0)

结果EDT没有任何问题,表示EST目前处于白天。实际上Mar 08仍然处于标准时间,Mar 09处于夏令时。

关于 EST 的一些事实:

Only some locations are currently on EST, because most places in this time zone are currently on Daylight Saving Time.
Locations that are on EST part of the year are currently on EDT (Eastern Daylight Time).