JavaScript Date Objects JAVASCRIPT

JavaScript Date Objects  

JavaScript Date Objects

Creating Date Objects

Date objects are created with the new Date() constructor.

There are 4 ways to create a new date object:

new Date()
new Date(year, month, day, hours, minutes, seconds, milliseconds)
new Date(milliseconds)
new Date(date string)

new Date()

new Date() creates a new date object with the current date and time:

Example

var d = new Date();

new Date(dateString)

new Date(dateString) creates a new date object from a date string.

Example

var d = new Date("October 13, 2014 11:13:00");

Download free E-book of JAVASCRIPT


#askProgrammers
Learn Programming for Free


Join Programmers Community on Telegram


Talk with Experienced Programmers


Just drop a message, we will solve your queries