- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
Timestamp sTs = Timestamp.valueOf("1900-12-31 23:59:59.999"); // Make Timestamp
System.out.println("sTs====>" + sTs.getTime());
sTs====> -2177485200001 // in jdk 1.4
Timestamp sTs = Timestamp.valueOf("1900-12-31 23:59:59.999"); // Make Timestamp
System.out.println("sTs====>" + sTs.getTime());
sTs====> -2177483400001 // in jdk 1.5
为什么这两个值不同?
最佳答案
根据 Sun 网站上现已删除的帖子
Daylight Saving Time (DST) is a system of handling the changing amounts of daylight throughout the year. The goal of DST is to maximize the daylight hours available during typical waking hours. By adjusting clocks ahead a standard amount, usually an hour, people can have more daylight available during their typical work day. For example, suppose you wake daily at 7:00 AM. In the spring, the sun rises earlier each day. Instead of waking up at 6:00 AM to take advantage of the daylight, DST observers move their clocks ahead an hour. The effect is that they can continue to wake at 7:00 AM according to the clock and enjoy more daylight. In the fall, people set their clocks back an hour as sunrise happens later each day.
The United States has planned a change to its DST observance beginning in 2007. The Energy Policy Act of 2005 mandates that DST will start on the second Sunday in March and end on the first Sunday in November. In 2007, the start and stop dates will be March 11 and November 4, respectively. These dates are different from previous DST start and stop dates. In 2006, the dates were the first Sunday in April (April 2, 2006) and the last Sunday in October (October 29, 2006).
The Java Runtime Environment (JRE) stores rules about DST observance all around the globe. Older JREs will have outdated rules that will be superseded by the Energy Policy Act of 2005. As a result, applications running on an older JRE may report incorrect time from March 11, 2007 through April 2, 2007 and from October 29, 2007 through November 4, 200
此更改已在 Java 1.4.2_13 中更新。因此,如果您的版本较旧,那么您会看到不同的行为。
关于java - Timestamp.valueOf() 根据 JVM 版本返回不同的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23778107/
String.valueOf(null); 为什么调用 valueOf(char[] c) 而为什么不调用 valueOf(Object o);?? 为什么 String.valueOf(null);
这个问题已经有答案了: Why does String.valueOf(null) throw a NullPointerException? (4 个回答) 已关闭 4 年前。 这不起作用(抛出空指
这个问题在这里已经有了答案: Why can't I access a property of an integer with a single dot? (5 个答案) 关闭 4 年前。 我猜 j
为什么下面的两个表达式返回不同的结果? Date().valueOf() "Fri Feb 07 2014 16:03:34 GMT-0500 (Eastern Standard Time)" new
使用阿拉伯数字 Integer.valueOf("۱")返回整数 1 但 Float.valueOf("۱")或 Float.parseFloat("۱")抛出 NumberFormatExcepti
我在处理一个问题时遇到了这个问题。发生的事情是: 当我们使用它时:BigInteger.valueOf(10000) 它给出的值为 10000 但是 当我们使用此 BigInteger.valueOf
这个问题是由strange HashMap.put() behaviour提示的 我想我明白为什么了Map.put需要 K但是Map.get需要 Object ,似乎不这样做会破坏太多现有代码。 现在
在我看来, reflect.ValueOf(&x).Elem() 等于 reflect.ValueOf(x) 因为 .Elem() 是获取reflect.Value 包含的指针的实际值。代码来了,js
我刚刚遇到了这个小问题,我希望其他人对此提出意见 我想知道将 String 转换为 int 的最佳解决方案是什么 (int)(float)Float.valueOf(s) 或 Float.valueO
我遇到了 IntegerCache 的问题:使用内部使用 iBatis PreparedStatement 类的 iBatis 数据访问框架。 像这样调用数据库过程 { call UPDATE_PRO
我正在阅读 javascript 手册并且我有以下代码: //sum function sum(arg1) { var sum = arg1; function f(arg2) {
这个问题在这里已经有了答案: Why does String.valueOf(null) throw a NullPointerException? (4 个回答) 关闭6年前。 对于以下行为是否有逻
我在调用 String.valueOf 方法时遇到问题。作为参数,我传递了返回 Integer 类型的通用方法。然后抛出异常,因为程序试图将返回的 Integer 转换为 char[] 以调用 Str
我正在创建 .jsp 页面并收到有关它的错误; String energyv=""; int number= Integer.parseInt(request.getP
我正在尝试使用枚举来包装应用程序中的某些错误代码。 public enum ErrorStatus { PAGE_NOT_FOUND("http 404", "lorem ipsum")
如果语句工作正常。其代码如下所示 if (getInput1.getText() != null) { float answer2 = Float.valueOf(getInput2.getTe
int x = 5; String s = "x = " + x; 在这种情况下,当原始类型转换为 String 时,将调用 valueOf() 方法。但如果我们这样做 System.out.prin
在我的工作中,所有开发人员都使用 Double.valueOf 而不是 new Double 构造函数。在每种情况下。对于整数或短,我可以理解缓存值,但不能理解 double和 float . 我看
我正在学习 JavaScript。这是我的问题: 我正在比较两个日期以确定它们是否相等。为此,我在两个日期上使用了 valueOf(),但是当我检查相同的日期时返回不同的值。 var today=ne
假设我需要通过 Array 类型覆盖内部 valueOf()... 作为explained here valueOf() 方法返回指定对象的原始值...所以,我想我们可以将原始值设置为任何数据类型..
我是一名优秀的程序员,十分优秀!