JS: 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 JS: 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 JS: Prototype and Inheritance]

Date Constructor

JS: Date Constructor

Properties


Date.prototype

JS: Date.prototype

Date.now

[see JS: Date.now]

Date.parse

[see JavaScript Date.parse]

Date.UTC

[see JS: Date.UTC]

Reference

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

Date Topic

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

  1. JS: Date Object
  2. JS: Date Constructor
  3. JS: 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
Liket it? Put $1 at patreon.

Or, Buy JavaScript in Depth