0

I am parsing the following dates:

Date.parse('03/16/20') = 1584334800000

And

Date.parse('03/16/201') = -55817838000000

Why the second expression returns negative value?

Thanks

Mark
  • 4,535
  • 7
  • 39
  • 76

1 Answers1

4

Epoch time is the number of seconds since January 1, 1970.

The year 201 is before that date, so the number of seconds since 1970 is negative.

(Two digit years are converted to 20th or 21st century years automatically)

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335