25.4. The Date Object

The Date object creates and manipulates dates and times.

Constructors

new Date() This constructor creates a Date object for the current time.

new Date(year, month, day) This constructor creates a Date object for midnight on the morning of the specified day.

new Date(year, month, day, hrs, mins, secs) This constructor creates a Date object for the specified time.

new Date("month day, year hrs:mins:secs") This constructor creates a Date object from the given string. The month should be the full name, not a number. For example,

var bDay = new Date("January 30, 1962 00:00:00");

new Date(millisecondsSinceEpoch) This constructor creates a Date object for the time corresponding to the specified number of milliseconds after midnight ...

Get Core Web Programming, Second Edition 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.