This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
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.
const utcDate1 = new Date(Date.UTC(96, 1, 2, 3, 4, 5)); const utcDate2 = new Date(Date.UTC(0, 0, 0, 0, 0, 0)); console.log(utcDate1.toUTCString()); // Expected output: "Fri, 02 Feb 1996 03:04:05 GMT" console.log(utcDate2.toUTCString()); // Expected output: "Sun, 31 Dec 1899 00:00:00 GMT"
Date.UTC(year) Date.UTC(year, monthIndex) Date.UTC(year, monthIndex, day) Date.UTC(year, monthIndex, day, hours) Date.UTC(year, monthIndex, day, hours, minutes) Date.UTC(year, monthIndex, day, hours, minutes, seconds) Date.UTC(year, monthIndex, day, hours, minutes, seconds, milliseconds)
yearInteger 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.
monthIndex OptionalInteger value representing the month, beginning with 0 for January to 11 for December. Defaults to 0.
day OptionalInteger value representing the day of the month. Defaults to 1.
hours OptionalInteger value between 0 and 23 representing the hour of the day. Defaults to 0.
minutes OptionalInteger value representing the minute segment of a time. Defaults to 0.
seconds OptionalInteger value representing the second segment of a time. Defaults to 0.
milliseconds OptionalInteger value representing the millisecond segment of a time. Defaults to 0.
A number representing the timestamp of the given date. Returns NaN if the date is invalid.
Years between 0 and 99 are converted to a year in the 20th century (1900 + year). For example, 95 is converted to the year 1995.
The UTC() method differs from the Date() constructor in three ways:
Date.UTC() uses universal time instead of the local time.Date.UTC() returns a time value as a number instead of creating a Date object.Date.UTC() interprets it as a year instead of a timestamp.If a parameter is outside of the expected range, the UTC() method updates the other parameters to accommodate the value. For example, if 15 is used for monthIndex, the year will be incremented by 1 (year + 1) and 3 will be used for the month.
Because UTC() is a static method of Date, you always use it as Date.UTC(), rather than as a method of a Date object you created.
The following statement creates a Date object with the arguments treated as UTC instead of local:
const utcDate = new Date(Date.UTC(2018, 11, 1, 0, 0, 0));
Date.UTC() when passed one argument used to have inconsistent behavior, because implementations only kept the behavior consistent with the Date() constructor, which does not interpret a single argument as the year number. Implementations are now required to treat omitted monthIndex as 0, instead of coercing it to NaN.
Date.UTC(2017); // 1483228800000
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-date.utc> |
| Desktop | Mobile | Server | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | Bun | Deno | Node.js | |
UTC |
1 | 12 | 1 | 3 | 1 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 | 1.0.0 | 1.0 | 0.10.0 |
optional_monthIndex |
≤15 | ≤15 | ≤4 | 15 | ≤10.1 | 18 | 4 | 14 | ≤10.3 | 1.0 | 4.4 | ≤10.3 | 1.0.0 | 1.0 | 8.0.0 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC