Creates a JavaScript Date
instance that represents a single moment in time in a platform-independent format. Date
objects contain a Number
that represents milliseconds since 1 January 1970 UTC.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
new Date(); new Date(value); new Date(dateString); new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]);
Note: The only correct way to instantiate a new Date
object is by using the new
operator. If you simply call the Date
object directly, such as now = Date()
, the returned value is a string rather than a Date
object.
Parameters
There are four basic forms for the Date()
constructor:
No parameters
When no parameters are provided, the newly-created Date
object represents the current date and time as of the time of instantiation.
Time value or timestamp number
value
- An integer value representing the number of milliseconds since January 1, 1970, 00:00:00 UTC (the ECMAScript epoch, equivalent to the UNIX epoch), with leap seconds ignored. Keep in mind that most UNIX Timestamp functions are only accurate to the nearest second.
Timestamp string
dateString
- A string value representing a date, specified in a format recognized by the
Date.parse()
method (these formats are IETF-compliant RFC 2822 timestamps and also strings in a version of ISO8601).Note: Parsing of date strings with the
Date
constructor (andDate.parse()
, which works the same way) is strongly discouraged due to browser differences and inconsistencies. Support for RFC 2822 format strings is by convention only. Support for ISO 8601 formats differs in that date-only strings (e.g. "1970-01-01") are treated as UTC, not local.
Individual date and time component values
Given at least a year and month, this form of Date()
returns a Date
object whose component values (year, month, day, hour, minute, second, and millisecond) all come from the following parameters. Any missing fields are given the lowest possible value (1 for the day
and 0 for every other component).
year
- Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999; all other values are the actual year. See the example below.
monthIndex
- Integer value representing the month, beginning with 0 for January to 11 for December.
day
Optional- Integer value representing the day of the month. If not specified, the default value of 1 is used.
hours
Optional- Integer value representing the hour of the day. The default is 0 (midnight).
minutes
Optional- Integer value representing the minute segment of a time. The default is 0 minutes past the hour.
seconds
Optional- Integer value representing the second segment of a time. The default is zero seconds past the minute.
milliseconds
Optional- Integer value representing the millisecond segment of a time. The default is 0 milliseconds past the second.
User notes
The ECMAScript epoch and timestamps
A JavaScript date is fundamentally specified as the number of milliseconds that have elapsed since midnight on January 1, 1970, UTC. This date and time is the same as the UNIX epoch, which is the predominant base value for computer-recorded date and time values.
Note: It's important to keep in mind that while the time value at the heart of a Date object is UTC, the basic methods to fetch the date and time or its components all work in the local (i.e. host system) time zone and offset.
A day is made up of 86,400,000 milliseconds. Given that and the size of the underlying number used to record the timestamp, and it can be calculated that the Date
object can represent dates within ±100,000,000 (one hundred million) days relative to January 1, 1970 UTC. That means that in the year 293,742, we'll have to think about fixing this.
Date format and time zone conversions
There are a number of methods available to obtain the date in various formats, as well as to do time zone conversions. Especially useful are the functions that output the date and time in Coordinated Universal Time (UTC), the global standard time defined by the World Time Standard. This time is historically known as Greenwich Mean Time, as UTC lies along the meridian that includes London and nearby Greenwhich in the United Kingdom. The user's device provides the local time.
In addition to methods to read and alter individual components of the local date and time, such as getDay()
and setHours()
, there are also versions of the same methods that read and manipulate the date and time using UTC, such as getUTCDay()
and setUTCHours()
.
Properties
Date.prototype
- Allows the addition of properties to a JavaScript
Date
object. Date.length
- The value of
Date.length
is 7. This is the number of arguments handled by the constructor. It's not generally a useful result.
Methods
Date.now()
- Returns the numeric value corresponding to the current time - the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC, with leap seconds ignored.
Date.parse()
- Parses a string representation of a date and returns the number of milliseconds since 1 January, 1970, 00:00:00, UTC, with leap seconds ignored.
Note: Parsing of strings with
Date.parse
is strongly discouraged due to browser differences and inconsistencies. Date.UTC()
- Accepts the same parameters as the longest form of the constructor (i.e. 2 to 7) and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC, with leap seconds ignored.
JavaScript Date
instances
All Date
instances inherit from Date.prototype
. The prototype object of the Date
constructor can be modified to affect all Date
instances.
Date.prototype Methods
Getter
Date.prototype.getDate()
- Returns the day of the month (1-31) for the specified date according to local time.
Date.prototype.getDay()
- Returns the day of the week (0-6) for the specified date according to local time.
Date.prototype.getFullYear()
- Returns the year (4 digits for 4-digit years) of the specified date according to local time.
Date.prototype.getHours()
- Returns the hour (0-23) in the specified date according to local time.
Date.prototype.getMilliseconds()
- Returns the milliseconds (0-999) in the specified date according to local time.
Date.prototype.getMinutes()
- Returns the minutes (0-59) in the specified date according to local time.
Date.prototype.getMonth()
- Returns the month (0-11) in the specified date according to local time.
Date.prototype.getSeconds()
- Returns the seconds (0-59) in the specified date according to local time.
Date.prototype.getTime()
- Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC (negative for prior times).
Date.prototype.getTimezoneOffset()
- Returns the time-zone offset in minutes for the current locale.
Date.prototype.getUTCDate()
- Returns the day (date) of the month (1-31) in the specified date according to universal time.
Date.prototype.getUTCDay()
- Returns the day of the week (0-6) in the specified date according to universal time.
Date.prototype.getUTCFullYear()
- Returns the year (4 digits for 4-digit years) in the specified date according to universal time.
Date.prototype.getUTCHours()
- Returns the hours (0-23) in the specified date according to universal time.
Date.prototype.getUTCMilliseconds()
- Returns the milliseconds (0-999) in the specified date according to universal time.
Date.prototype.getUTCMinutes()
- Returns the minutes (0-59) in the specified date according to universal time.
Date.prototype.getUTCMonth()
- Returns the month (0-11) in the specified date according to universal time.
Date.prototype.getUTCSeconds()
- Returns the seconds (0-59) in the specified date according to universal time.
Date.prototype.getYear()
- Returns the year (usually 2-3 digits) in the specified date according to local time. Use
getFullYear()
instead.
Setter
Date.prototype.setDate()
- Sets the day of the month for a specified date according to local time.
Date.prototype.setFullYear()
- Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to local time.
Date.prototype.setHours()
- Sets the hours for a specified date according to local time.
Date.prototype.setMilliseconds()
- Sets the milliseconds for a specified date according to local time.
Date.prototype.setMinutes()
- Sets the minutes for a specified date according to local time.
Date.prototype.setMonth()
- Sets the month for a specified date according to local time.
Date.prototype.setSeconds()
- Sets the seconds for a specified date according to local time.
Date.prototype.setTime()
- Sets the
Date
object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC, allowing for negative numbers for times prior. Date.prototype.setUTCDate()
- Sets the day of the month for a specified date according to universal time.
Date.prototype.setUTCFullYear()
- Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to universal time.
Date.prototype.setUTCHours()
- Sets the hour for a specified date according to universal time.
Date.prototype.setUTCMilliseconds()
- Sets the milliseconds for a specified date according to universal time.
Date.prototype.setUTCMinutes()
- Sets the minutes for a specified date according to universal time.
Date.prototype.setUTCMonth()
- Sets the month for a specified date according to universal time.
Date.prototype.setUTCSeconds()
- Sets the seconds for a specified date according to universal time.
Date.prototype.setYear()
- Sets the year (usually 2-3 digits) for a specified date according to local time. Use
setFullYear()
instead.
Conversion getter
Date.prototype.toDateString()
- Returns the "date" portion of the
Date
as a human-readable string like 'Thu Apr 12 2018' Date.prototype.toISOString()
- Converts a date to a string following the ISO 8601 Extended Format.
Date.prototype.toJSON()
- Returns a string representing the
Date
usingtoISOString()
. Intended for use byJSON.stringify()
. Date.prototype.toGMTString()
- Returns a string representing the
Date
based on the GMT (UT) time zone. UsetoUTCString()
instead. Date.prototype.toLocaleDateString()
- Returns a string with a locality sensitive representation of the date portion of this date based on system settings.
Date.prototype.toLocaleFormat()
- Converts a date to a string, using a format string.
Date.prototype.toLocaleString()
- Returns a string with a locality sensitive representation of this date. Overrides the
Object.prototype.toLocaleString()
method. Date.prototype.toLocaleTimeString()
- Returns a string with a locality sensitive representation of the time portion of this date based on system settings.
Date.prototype.toSource()
- Returns a string representing the source for an equivalent
Date
object; you can use this value to create a new object. Overrides theObject.prototype.toSource()
method. Date.prototype.toString()
- Returns a string representing the specified
Date
object. Overrides theObject.prototype.toString()
method. Date.prototype.toTimeString()
- Returns the "time" portion of the
Date
as a human-readable string. Date.prototype.toUTCString()
- Converts a date to a string using the UTC timezone.
Date.prototype.valueOf()
- Returns the primitive value of a
Date
object. Overrides theObject.prototype.valueOf()
method.
Examples
Several ways to create a Date
object
The following examples show several ways to create JavaScript dates:
Note: parsing of date strings with the Date
constructor (and Date.parse
, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
var today = new Date(); var birthday = new Date('December 17, 1995 03:24:00'); var birthday = new Date('1995-12-17T03:24:00'); var birthday = new Date(1995, 11, 17); var birthday = new Date(1995, 11, 17, 3, 24, 0);
Two digit years map to 1900 - 1999
In order to create and get dates between the years 0 and 99 the Date.prototype.setFullYear()
and Date.prototype.getFullYear()
methods should be used.
var date = new Date(98, 1); // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT) // Deprecated method, 98 maps to 1998 here as well date.setYear(98); // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT) date.setFullYear(98); // Sat Feb 01 0098 00:00:00 GMT+0000 (BST)
Calculating elapsed time
The following examples show how to determine the elapsed time between two JavaScript dates in milliseconds.
Due to the differing lengths of days (due to daylight saving changeover), months and years, expressing elapsed time in units greater than hours, minutes and seconds requires addressing a number of issues and should be thoroughly researched before being attempted.
// using Date objects var start = Date.now(); // the event to time goes here: doSomethingForALongTime(); var end = Date.now(); var elapsed = end - start; // elapsed time in milliseconds
// using built-in methods var start = new Date(); // the event to time goes here: doSomethingForALongTime(); var end = new Date(); var elapsed = end.getTime() - start.getTime(); // elapsed time in milliseconds
// to test a function and get back its return function printElapsedTime(fTest) { var nStartTime = Date.now(), vReturn = fTest(), nEndTime = Date.now(); console.log('Elapsed time: ' + String(nEndTime - nStartTime) + ' milliseconds'); return vReturn; } var yourFunctionReturn = printElapsedTime(yourFunction);
Note: In browsers that support the Web Performance API's high-resolution time feature, Performance.now()
can provide more reliable and precise measurements of elapsed time than Date.now()
.
Get the number of seconds since the ECMAScript Epoch
var seconds = Math.floor(Date.now() / 1000);
In this case it's important to return only an integer (so a simple division won't do), and also to only return actually elapsed seconds (that's why this code uses Math.floor()
and not Math.round()
).
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript Latest Draft (ECMA-262) The definition of 'Date' in that specification. |
Draft | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Date' in that specification. |
Standard | |
ECMAScript 5.1 (ECMA-262) The definition of 'Date' in that specification. |
Standard | |
ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.1. |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Date | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE
Full support
3
| Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
UTC | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getDate | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getDay | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getFullYear | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getHours | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getMilliseconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getMinutes | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getMonth | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getSeconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getTime | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getTimezoneOffset | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCDate | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCDay | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCFullYear | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCHours | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCMilliseconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCMinutes | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCMonth | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getUTCSeconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
getYear | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
now | Chrome Full support 5 | Edge Full support 12 | Firefox Full support 3 | IE Full support 9 | Opera Full support 10.5 | Safari Full support 4 | WebView Android Full support Yes | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes | nodejs Full support Yes |
parse | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
parse : ISO 8601 format | Chrome Full support 6 | Edge Full support 12 | Firefox Full support 4 | IE Full support 9 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs ? |
prototype | Chrome Full support 1 | Edge Full support 12 | Firefox
Full support
1
| IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android
Full support
4
| Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setDate | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setFullYear | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setHours | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setMilliseconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setMinutes | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setMonth | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setSeconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setTime | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCDate | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCFullYear | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCHours | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCMilliseconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCMinutes | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCMonth | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setUTCSeconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
setYear | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toDateString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toGMTString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toISOString | Chrome Full support 3 | Edge Full support 12 | Firefox Full support 1 | IE Full support 9 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toJSON | Chrome Full support 3 | Edge Full support 12 | Firefox Full support 1 | IE Full support 8 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toLocaleDateString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toLocaleDateString : IANA time zone names in timeZone option | Chrome Full support 24 | Edge Full support 14 | Firefox Full support 52 | IE No support No | Opera Full support 15 | Safari ? | WebView Android Full support 37 | Chrome Android Full support 25 | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android Full support 1.5 | nodejs Full support Yes |
toLocaleDateString.locales | Chrome Full support 24 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 15 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 26 | Firefox Android Full support 56 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 1.5 | nodejs
Full support
0.12
|
toLocaleDateString.options | Chrome Full support 24 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 15 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 26 | Firefox Android Full support 56 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 1.5 | nodejs Full support Yes |
toLocaleFormat | Chrome No support No | Edge No support No | Firefox No support 1.5 — 58 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android No support 4 — 58 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs No support No |
toLocaleString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toLocaleString : IANA time zone names in timeZone option | Chrome Full support 24 | Edge Full support 14 | Firefox Full support 52 | IE No support No | Opera Full support 15 | Safari ? | WebView Android Full support 37 | Chrome Android Full support 25 | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android Full support 1.5 | nodejs Full support Yes |
toLocaleString.locales | Chrome Full support 24 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 15 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 26 | Firefox Android Full support 56 | Opera Android Full support 14 | Safari iOS Full support 10 | Samsung Internet Android Full support 1.5 | nodejs
Full support
0.12
|
toLocaleString.options | Chrome Full support 24 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 15 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 26 | Firefox Android Full support 56 | Opera Android Full support 14 | Safari iOS Full support 10 | Samsung Internet Android Full support 1.5 | nodejs Full support Yes |
toLocaleTimeString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toLocaleTimeString : IANA time zone names in timeZone option | Chrome Full support 24 | Edge Full support 14 | Firefox Full support 52 | IE No support No | Opera Full support 15 | Safari ? | WebView Android Full support 37 | Chrome Android Full support 25 | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android Full support 1.5 | nodejs Full support Yes |
toLocaleTimeString.locales | Chrome Full support 24 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 15 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 26 | Firefox Android Full support 56 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 1.5 | nodejs
Full support
0.12
|
toLocaleTimeString.options | Chrome Full support 24 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 15 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 26 | Firefox Android Full support 56 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 1.5 | nodejs Full support Yes |
toSource | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs No support No |
toString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toTimeString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
toUTCString | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
valueOf | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
@@toPrimitive | Chrome Full support 47 | Edge Full support 15 | Firefox Full support 44 | IE No support No | Opera Full support 34 | Safari ? | WebView Android Full support 47 | Chrome Android Full support 47 | Firefox Android Full support 44 | Opera Android Full support 34 | Safari iOS ? | Samsung Internet Android Full support 5.0 | nodejs Full support 6.0.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- See implementation notes.
- See implementation notes.