-62135596800000 0001-01-03 00: 00: 00.0 Since, by default, java uses the Julian calendar for dates until October 15, 1582 .
The website you use uses javascript, which uses an extrapolated or proleptic Gregorian calendar for all dates. From javascript specification
ECMAScript uses an extrapolated Gregorian system to match the day number with the year number and determine the month and date for that year.
In fact, in javascript:
new Date(-62135596800000).toUTCString()
You can use something like this in java to get the same results:
GregorianCalendar date = new GregorianCalendar(); date.clear(); //Use Gregorian calendar for all values date.setGregorianChange(new Date(Long.MIN_VALUE)); date.setTimeZone( TimeZone.getTimeZone("UTC")); date.setTime(new Date(-62135596800000L)); System.out.println( date.get(GregorianCalendar.YEAR) + "-" + (date.get(GregorianCalendar.MONTH) + 1) + "-" + date.get(GregorianCalendar.DAY_OF_YEAR) + " " + date.get(GregorianCalendar.HOUR_OF_DAY) + ":" + date.get(GregorianCalendar.MINUTE) + ":" + date.get(GregorianCalendar.SECOND) + "." + date.get(GregorianCalendar.MILLISECOND) ); //Prints 1-1-1 0:0:0.0
Unfortunately, I donβt know how to make the Gregorian change from Calendar to Date objects, so I do formatting directly from the calendar object. If I just did formatter.format(date.getTime()) it would lose the Gregorian change setting and show the third day.
The Julian date is 2 days ahead, because according to this , Julian is 2 days ahead of the stately Gregorian by 2 days from 1 to 100 A.D.
Btw, I recommend using JodaTime , this is correct (my opinion though, if you need something more convincing ) the default is pure Gregorian:
DateTime dt = new DateTime(-62135596800000L, DateTimeZone.UTC); System.out.println(dt.toString());
source share