Reputation: 1
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
Upvotes: 0
Views: 34
Reputation: 413737
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.
Upvotes: 3