是否可以使用Java日曆/日期/時間區API獲取前一個和下一個DST轉換時間戳?
隨着Joda-Time
我可以這樣寫:使用java.util.TimeZone查找DST轉換時間戳
DateMidnight today = new DateMidnight(2009, 2, 24);
DateTimeZone zone = today.getZone();
DateTime previousTransition =
new DateTime(zone.previousTransition(today.getMillis()));
// 2008-10-26T02:59:59.999+02:00 for Europe/Berlin
System.out.println(previousTransition);
DateTime nextTransition =
new DateTime(zone.nextTransition(today.getMillis()));
// 2009-03-29T03:00:00.000+02:00 for Europe/Berlin
System.out.println(nextTransition);
有沒有辦法與標準Java API來做到這一點?
有在Java中8,看我的回答 – Gov 2017-06-19 04:28:43