Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
java Date 类期望很长:
但是当前的日期/时间到毫秒精度太大而无法长时间保存。
Hello.java:14:整数太大:1335250803004 long l = 1335250803004;
那么这到底是如何工作的呢?
毫秒值表示自1970 年 1 月 1 日 00:00:00.000 GMT [..]
所以它能够保持日期最多
08-17-292278994
嗯?
public static void main(String[] args) { System.out.println(Long.MAX_VALUE); System.out.println(new Date().getTime()); System.out.println(new Date().getTime() < Long.MAX_VALUE); }
印刷:
9223372036854775807 1337770864719 true