gpt4 book ai didi

timezone - IBM 与 Oracle/Sun JDK,java.util.Timzone getOffset () 的行为不同

转载 作者:行者123 更新时间:2023-11-30 11:44:11 26 4
gpt4 key购买 nike

IBM 与 Oracle/Sun JDK,java.util.Timzone 的行为不同,

IBM JDK 1.5 与 Sun/Oracle JDK 1.6

import java.util.*;
class TimeTest {

public static void main(String args[]){

long now = System.currentTimeMillis();

System.out.println("EST : " + TimeZone.getTimeZone("EST").getOffset(now));
System.out.println("US/Eastern : " + TimeZone.getTimeZone("US/Eastern").getOffset(now));

}
}


***IBM JVM ouput

EST : -14400000
US/Eastern : -14400000

Oracle JVM

EST : -18000000
US/Eastern : -14400000
IBM JDK

java -version

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxi32devifx-20090811 (SR10 +IZ56666+IZ56751))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20090707 (JIT enabled)
J9VM - 20090706_38445_lHdSMr
JIT - 20090623_1334_r8
GC - 200906_09)
JCL - 20090811


Oracle JDK

java -version

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

更新,使用 IBM JDK 6 测试,它匹配 oracle/sun 的输出 java-版本 Java 版本“1.6.0” Java(TM) SE 运行时环境 (build pxi3260sr6ifix-20091015_01(SR6+152211+155930+156106)) IBM J9 VM(build 2.4,JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr6-20091001_43491(启用 JIT,启用 AOT) J9VM - 20091001_043491 JIT-r9_20090902_1330ifx1 气相色谱 - 20090817_AA) JCL-20091006_01

java TimeTest
EST : -18000000
US/Eastern : -14400000***

最佳答案

IBM 告诉我们 the answer :

In 2006, the meaning of the EST time zone identifier changed in the Olson database. Historically, EST referred to the American Eastern Standard Time and made adjustments for daylight saving time. Following the change, EST refers to Eastern Standard Time with no adjustment for daylight saving time. A new identifier EST5EDT was also introduced that had the same meaning as the original EST identifier.

关于timezone - IBM 与 Oracle/Sun JDK,java.util.Timzone getOffset () 的行为不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10887761/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com