javascript - How does minus integer work in Date? -


how javascript date interpret milisecond integers?

var d = new date(-1724115600000); //this gives me date in past, want console.log(d);  var d = new date(1724115600000);  console.log(d); 

(we had bug - sign not getting through. dont understand significance of -)

the date object constructor can take variety of inputs, when called in fashion it's using integer value one:

integer value representing number of milliseconds since 1 january 1970 00:00:00 utc (unix epoch).

negative values give dates before unix epoch, positive values dates after epoch.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -