Creating a Date Object

var d = new Date(); //Wed Jan 30 2013 09:37:42 GMT-0700 var d = new Date(1209516513246); //Tue Apr 29 2008 18:48:33 GMT-0600 var d = new Date("May 17 2014 13:55:13 GMT-0600"); //Sat May 17 2014 13:55:13 GMT-0600 var d = new Date("1/1/2020"); //Sat Jan 01 2020 00:00:00 GMT-0700 var d = new Date("12/12/2012 12:12:12"); //Wed Dec 12 2012 12:12:12 GMT-0700 var d = new Date(2014, 8, 6, 16, 5, 10, 3); //Sat Sep 06 2014 16:05:10 GMT-0600

A Date object represents a specific date and time with millisecond granularity. To create a Date object, all you need to do is call a new Date() using one of the following methods. The dateString can be in one of several different formats, such as "7-17-2013" ...

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.