JavaScript provides a parallel set of UTC methods for reading a Date without applying the host's local time-zone offset. Use them when your calculation or data exchange is explicitly based on Coordinated Universal Time.
const date = new Date("2026-09-10T12:00:00Z");
console.log(date.getUTCHours()); // 12
console.log(date.toUTCString());
The same Date can produce different local components depending on the environment, while its UTC components refer to the same instant.
const now = new Date();
console.log(now.getHours());
console.log(now.getUTCHours());
getHours() uses local time. getUTCHours() uses UTC.
| UTC method | Range / meaning |
|---|---|
getUTCFullYear() | Full UTC year. |
getUTCMonth() | 0–11. |
getUTCDate() | 1–31. |
getUTCDay() | 0 Sunday through 6 Saturday. |
getUTCHours() | 0–23. |
getUTCMinutes() | 0–59. |
getUTCSeconds() | 0–59. |
getUTCMilliseconds() | 0–999. |
const date = new Date("2026-09-10T12:34:56.789Z");
console.log(date.getUTCFullYear());
console.log(date.getUTCMonth());
console.log(date.getUTCDate());
console.log(date.getUTCHours());
getTimezoneOffset() returns the difference, in minutes, between the Date interpreted as UTC and as local time. The sign can feel reversed: local zones ahead of UTC return a negative value.
const offsetMinutes = new Date().getTimezoneOffset();
console.log(offsetMinutes);
The result reflects the host environment and the represented date. In regions with daylight-saving changes, the value can vary across the year.
const date = new Date();
console.log(date.toUTCString());
toUTCString() is useful for a readable UTC representation. For machine-oriented ISO output, prefer toISOString().
const timestamp = Date.UTC(2026, 8, 10, 12, 0, 0);
const date = new Date(timestamp);
Date.UTC() uses zero-based month numbers, just like the numeric Date constructor, but interprets the components as UTC.
const iso = new Date().toISOString();
console.log(iso);
The returned string is UTC and ends in Z.
UTC methods do not convert a Date into arbitrary named zones such as Asia/Kolkata or America/New_York. Use locale formatting with a timeZone option.
const text = new Date().toLocaleString("en-IN", {
timeZone: "Asia/Kolkata",
dateStyle: "medium",
timeStyle: "medium"
});
Do not assume one fixed offset represents a named time zone for all dates. Some zones change offset because of daylight-saving rules or historical changes. Named-zone formatting lets the runtime apply the appropriate rule for the represented instant.
getTimezoneOffset() returns the offset written in the input string; it reflects the host's local zone.Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.