0

See http://worik.org/DateBug.html for an example.

    document.write( Date(1234).toLocaleString()+"<p/>"); 

outputs Tue Aug 12 2014 09:43:22 GMT+1200 (NZST)

(as I write) but

    var D1 = new Date(1234);
    document.write(D1.toLocaleString()+"<p/>");

outputs

    1/01/1970 12:00:01 pm

I do not so much care about the format, though that is a puzzle, but the dates are different.

Worik

Worik
  • 1

1 Answers1

3

If you don't involve the new operator, the Date constructor returns a string representing the current time and it ignores any argument you pass.

This is the sort of question for which simple API documentation is appropriate.

Pointy
  • 405,095
  • 59
  • 585
  • 614