JavaScript: Date Object

By Xah Lee. Date: . Last updated: .

Date is the value of the property key "Date" of the global object.

console.log ( window["Date"] === Date ); // true

Date is a function.

〔►see JavaScript: Data Types

console.log ( typeof Date === "function" ); // true

The parent of Date is Function.prototype.

// parent of Date object
console.log ( Object.getPrototypeOf ( Date ) === Function.prototype ); // true

The purpose of Date is:

  1. To create a date instance. (by new Date(…))
  2. Used as a namespace to hold static methods for working with date. For example, Date.parse(string).
  3. Holds the property key "prototype". The value of Date.prototype is the root parent object of all date instances. 〔►see JavaScript: Prototype and Inheritance

Date Constructor

JavaScript: Date Constructor

Properties


Date.prototype

JavaScript: Date.prototype

Date.now

〔►see JavaScript: Date.now

Date.parse

〔►see JavaScript Date.parse

Date.UTC

〔►see JavaScript: Date.UTC

Reference

ECMAScript 2015 §Numbers and Dates#sec-date-objects

Date Topic

  1. JavaScript: Date Tutorial
  2. JavaScript Date.parse
  3. JavaScript: Compute Date Range

  1. JavaScript: Date Object
  2. JavaScript: Date Constructor
  3. JavaScript: Date.prototype

JS Object Reference

  1. Global
  2. Object
  3. Array
  4. Function
  5. String
  6. RegExp
  7. Date
  8. Set
  9. Map
  10. JSON
  11. Math
  12. Reflect
  13. Number
  14. Boolean
  15. Symbol
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.