JavaScript syntax: Difference between revisions

Content deleted Content added
Date: month is zero-padded
Line 412:
<syntaxhighlight lang=JavaScript>
new Date(); // create a new Date instance representing the current time/date.
new Date(2010, 32, 1); // create a new Date instance representing 2010-Mar-01 00:00:00
new Date(2010, 32, 1, 14, 25, 30); // create a new Date instance representing 2010-Mar-01 14:25:30
new Date("2010-3-1 14:25:30"); // create a new Date instance from a String.
</syntaxhighlight>
Line 420:
 
<syntaxhighlight lang=JavaScript>
var d = new Date(2010, 32, 1, 14, 25, 30); // 2010-Mar-01 14:25:30;
 
// Displays '2010-3-1 14:25:30':