O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required