Java 给出了错误的时区
Java gives wrong time zone
Java 在我的 Android 设备上给出了错误的时区输出。
TimeZone tz = TimeZone.getDefault();
System.out.println(tz.getDisplayName(false, TimeZone.SHORT));
输出:
EET
但应该是
EEST
在设备上的日期和时间设置中,它是 EEST(GMT+03:00,伊斯坦布尔)。
getDisplayName()
的第一个参数是:
daylightTime true for daylight time, false for standard time.
鉴于 false
,您将在 EEST
(UTC+3) 中获得设备的 EET
(UTC+2)。
Java 在我的 Android 设备上给出了错误的时区输出。
TimeZone tz = TimeZone.getDefault();
System.out.println(tz.getDisplayName(false, TimeZone.SHORT));
输出:
EET
但应该是
EEST
在设备上的日期和时间设置中,它是 EEST(GMT+03:00,伊斯坦布尔)。
getDisplayName()
的第一个参数是:
daylightTime true for daylight time, false for standard time.
鉴于 false
,您将在 EEST
(UTC+3) 中获得设备的 EET
(UTC+2)。