Unix Time Conversion between Language

I have this unix timestamp in milliseconds: -62135769600000

I tried to convert the timestamp using java and javascript, but I got two different response. look below:

Date d = new Date(-62135769600000L);
System.out.println(d); // output = Sat Jan 01 00:00:00 GMT 1
d = new Date(-62135769600000L)
console.log(d) // output = Fri Dec 29 0000 19:00:00 GMT-0500 (EST)

As you can see, we have two different results. I want to understand why and if possible how to fix that.

Leave a Comment