Widely availableSupported across all major browsers. Safe to use in production.

Overview

The Date object represents a single moment in time.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
1
18
1

The [Symbol.toPrimitive]() method of Date instances returns a primitive value representing this date. It may either be a string or a number, depending on the hint given.

47
15
44
10
47
10

The Date() constructor creates Date objects. When called as a function, it returns a string representing the current time.

1
12
1
1
18
1

The Date.UTC() static method accepts parameters representing the date and time components similar to the Date constructor, but treats them as UTC. It returns the number of milliseconds since January 1, 1970, 00:00:00 UTC.

1
12
1
1
18
1
Date.UTC.optional monthIndex

`monthIndex` defaults to 0

≤15
≤15
≤4
≤10.1
18
≤10.3

The getDate() method of Date instances returns the day of the month for this date according to local time.

1
12
1
1
18
1

The getDay() method of Date instances returns the day of the week for this date according to local time, where 0 represents Sunday. For the day of the month, see Date.prototype.getDate().

1
12
1
1
18
1

The getFullYear() method of Date instances returns the year for this date according to local time.

1
12
1
1
18
1

The getHours() method of Date instances returns the hours for this date according to local time.

1
12
1
1
18
1

The getMilliseconds() method of Date instances returns the milliseconds for this date according to local time.

1
12
1
1
18
1

The getMinutes() method of Date instances returns the minutes for this date according to local time.

1
12
1
1
18
1

The getMonth() method of Date instances returns the month for this date according to local time, as a zero-based value (where zero indicates the first month of the year).

1
12
1
1
18
1

The getSeconds() method of Date instances returns the seconds for this date according to local time.

1
12
1
1
18
1

The getTime() method of Date instances returns the number of milliseconds for this date since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC.

1
12
1
1
18
1

The getTimezoneOffset() method of Date instances returns the difference, in minutes, between this date as evaluated in the UTC time zone, and the same date as evaluated in the local time zone.

1
12
1
1
18
1

The getUTCDate() method of Date instances returns the day of the month for this date according to universal time.

1
12
1
1
18
1

The getUTCDay() method of Date instances returns the day of the week for this date according to universal time, where 0 represents Sunday.

1
12
1
1
18
1

The getUTCFullYear() method of Date instances returns the year for this date according to universal time.

1
12
1
1
18
1

The getUTCHours() method of Date instances returns the hours for this date according to universal time.

1
12
1
1
18
1

The getUTCMilliseconds() method of Date instances returns the milliseconds for this date according to universal time.

1
12
1
1
18
1

The getUTCMinutes() method of Date instances returns the minutes for this date according to universal time.

1
12
1
1
18
1

The getUTCMonth() method of Date instances returns the month for this date according to universal time, as a zero-based value (where zero indicates the first month of the year).

1
12
1
1
18
1

The getUTCSeconds() method of Date instances returns the seconds in the specified date according to universal time.

1
12
1
1
18
1

The Date.now() static method returns the number of milliseconds elapsed since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC.

1
12
1
4
18
4

The Date.parse() static method parses a string representation of a date, and returns the date's timestamp.

1
12
1
1
18
1
Date.parse.iso 8601

ISO 8601 format

6
12
4
5.1
18
5

The setDate() method of Date instances changes the day of the month for this date according to local time.

1
12
1
1
18
1

The setFullYear() method of Date instances changes the year, month, and/or day of month for this date according to local time.

1
12
1
1
18
1

The setHours() method of Date instances changes the hours, minutes, seconds, and/or milliseconds for this date according to local time.

1
12
1
1
18
1

The setMilliseconds() method of Date instances changes the milliseconds for this date according to local time.

1
12
1
1
18
1

The setMinutes() method of Date instances changes the minutes for this date according to local time.

1
12
1
1
18
1

The setMonth() method of Date instances changes the month and/or day of the month for this date according to local time.

1
12
1
1
18
1

The setSeconds() method of Date instances changes the seconds and/or milliseconds for this date according to local time.

1
12
1
1
18
1

The setTime() method of Date instances changes the timestamp for this date, which is the number of milliseconds since the epoch, defined as the midnight at the beginning of January 1, 1970, UTC.

1
12
1
1
18
1

The setUTCDate() method of Date instances changes the day of the month for this date according to universal time.

1
12
1
1
18
1

The setUTCFullYear() method of Date instances changes the year for this date according to universal time.

1
12
1
1
18
1

The setUTCHours() method of Date instances changes the hours, minutes, seconds, and/or milliseconds for this date according to universal time.

1
12
1
1
18
1

The setUTCMilliseconds() method of Date instances changes the milliseconds for this date according to universal time.

1
12
1
1
18
1

The setUTCMinutes() method of Date instances changes the minutes for this date according to universal time.

1
12
1
1
18
1

The setUTCMonth() method of Date instances changes the month and/or day of the month for this date according to universal time.

1
12
1
1
18
1

The setUTCSeconds() method of Date instances changes the seconds and/or milliseconds for this date according to universal time.

1
12
1
1
18
1

The toDateString() method of Date instances returns a string representing the date portion of this date interpreted in the local timezone.

1
12
1
1
18
1

The toISOString() method of Date instances returns a string representing this date in the date time string format, a simplified format based on ISO 8601, which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always UTC, as denoted by the suffix Z.

3
12
1
4
18
3.2

The toJSON() method of Date instances returns a string representing this date in the same ISO format as Date/toISOString.

3
12
1
4
18
3.2

The toString() method of Date instances returns a string representing this date interpreted in the local timezone.

1
12
1
1
18
1

The toTimeString() method of Date instances returns a string representing the time portion of this date interpreted in the local timezone.

1
12
1
1
18
1

The toUTCString() method of Date instances returns a string representing this date in the RFC 7231 format, with negative years allowed. The timezone is always UTC. toGMTString() is an alias of this method.

1
12
1
1
18
1

The valueOf() method of Date instances returns the number of milliseconds for this date since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC.

1
12
1
1
18
1
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
const now = new Date();
now.getFullYear();  // 2026
now.getMonth();     // 3 (zero-based, April)
now.toLocaleDateString('ja-JP'); // '2026/4/6'

// Generated from an ISO 8601 string
const date = new Date('2026-04-06T12:00:00Z');

Live demo

Real-timeclock

currenttime 1 per and to read, Japan. shape notation in display..

PreviewFullscreen

Weekday. Automatic Detection

specific. Date(example: 2026-04-06) that weekday or check..

PreviewFullscreen

Date. Differencecalculation

from the end of the year(1231) to and exists or calculation..

PreviewFullscreen

Use cases

  • Using Date

    The Date object represents a single moment in time.

Cautions

  • No specific concerns. Stable across all major browsers.

Accessibility

  • When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.

Powered by web-features