我正在测试"2016-03-28T02:00:00+0200"
(1459123200 in UTC Sec.)
减去 1 天后,应用 DST,输出应为:
“2016-03-27T03:00:00+0200”
但我得到了这个:
2016-03-26T01:00+01:00[欧洲/斯德哥尔摩]
代码:
public class DateFormatSampleCode {
public static void main(String[] args)
{
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(1459123200, 0, ZoneOffset.UTC);
System.out.println(localDateTime);
localDateTime = localDateTime.minusDays(1);
System.out.println(localDateTime);
ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, ZoneId.of("Europe/Stockholm"));
System.out.println(zonedDateTime);
}
}
请检查并指出我哪里出错了。