我認爲2011-10-23 12:00:00
將保持與UTC
相同,並且Converted date
將是2011-10-23 17:00:00
。爲什麼「12:00」轉換爲UTC變爲「11:00」?
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dt = formatter.parse("2011-10-23 12:00:00");
LocalDateTime ldt = new DateTime(dt).withZone(DateTimeZone.UTC).toLocalDateTime();
LOGGER.warn("Original date: " + ldt.toDateTime().toDate().toString());
DateTime cvtldt = ldt.toDateTime(DateTimeZone.forID("-05:00"));
LOGGER.warn("Converted date: " + cvtldt.toLocalDateTime().toDateTime().toDate().toString());
我不明白爲什麼輸出爲負1小時?
Original date: Sun Oct 23 11:00:00 BST 2011
Converted date: Sun Oct 23 11:00:00 BST 2011
夏令時或什麼? (狂猜) – Kos
DST? ---------------- –