Epoch or Unix Time - Long.MAX_VALUE Human Read Date

If stored in milliseconds , what is the human-readable date for the dateTime value? The era is Thursday, January 1, 1970, and I mean a long time in Java.

long dateTime = Long.MAX_VALUE; 

All online tools seem to crash when I give them so much value.

+4
source share
3 answers
System.out.println(new java.util.Date(Long.MAX_VALUE).toGMTString());
// output:  17 Aug 292278994 07:12:55 GMT
+9
source

I accepted Matt Johnson the correct answer and tried it in Joda-Time 2.3 on Java 7 on OS X (Mountain Lion). I got the same result.

// ÂĐ 2013 Basil Bourque. This source code may be used freely forever by anyone taking full responsibility for doing so.

System.out.println( "Long.MAX_VALUE: " + Long.MAX_VALUE );
org.joda.time.DateTime endOfTime = new org.joda.time.DateTime( Long.MAX_VALUE );
org.joda.time.DateTime endOfTimeUtc = endOfTime.toDateTime( org.joda.time.DateTimeZone.UTC );
System.out.println( "endOfTimeUtc: " + endOfTimeUtc );

At startup ...

Long.MAX_VALUE: 9223372036854775807
endOfTimeUtc: 292278994-08-17T07:12:55.807Z

, .

+4

, - : 1385148606519. 1000, 1385148606519000, Wed 12 45863 2:48:39 UTC. 1 8, 8385148606519000, 12 267684 3:15:19 UTC. , Javascript: 8640000007200000, 13 2775760 3:00:00. , , ... , ?:)

For simplicity, you can try to consider no. from millions per year with 365 days: 31556952000. Therefore, ignoring for a moment any kind of the second or second jump, we can divide MAX_VALUE into the fact that 9223372036854775807/31556952000 = 292277024.627 years from 1970, which probably means about 292278994 years.

+2
source

All Articles