The date Object [2|3|I]

The date object provides mechanisms for working with dates and times in JavaScript. Instances of the object can be created with the following syntax:

newObjectName = new Date(dateInfo)

Here, dateInfo is an optional specification of a particular date and can be one of the following:

"month day, year hours:minutes:seconds"

year, month, day

year, month, day, hours, minutes, seconds

The latter two options represent integer values.

If no dateInfo is specified, the new object represents the current date and time.

Properties

  • prototype— Provides a mechanism for adding properties to a date object. (Not 2.)

Methods

  • getDate()— Returns the day of the month for the current date object as an integer from 1 to 31.

  • getDay()— Returns ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 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.