Java and JavaScript timestamps do not match

I have a problem with timestamps between java and javascript.

I have already found these 2 questions about timestamps, and I have known about temporary changes over the years.

Java vs. Javascript timeline deviation for old dates (3600 seconds)

Why is the subtraction of these two times (in 1927) giving a strange result?

Basically, at midnight at the end of 1927, the clock returned 5 minutes and 52 seconds. So, β€œ1927-12-31 23:54:08” actually happened twice, and it looks like Java is parsing it as possible instantly for this local date / time.

What is the problem: when I have javascript and put the timestamp there, I get a different date than the Java date. I need this to show the correct date on the web page. I know that I can request the date as a string, but I prefer to use a timestamp.

Java Date 0001-01-01 timestamp is -62135773200000

JavaScript Date 0001-01-01 timestamp is -62135596800000

The difference is -176400000; 49 hours.

Does anyone know what I can do for this.

+4
source share
2 answers

, , .

(ISO-8601) . 0001-01-01T00:00:00+00:00. , .

+4

TZ DST, java. , ISO-8601, 2008-02-01T09:00:22+05,

0

Source: https://habr.com/ru/post/1617755/


All Articles