JavaScript Date getUTCHours() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.getUTCHours() returns the hour of the day as an integer 0–23 in UTC. It is read-only and does not change the Date.

Remember
date.getUTCHours()

0  = midnight UTC
12 = noon UTC
23 = 11 PM UTC

→ NaN if the Date is invalid

getUTCHours() → hour in UTC (0–23)
getHours()    → hour in local time

Syntax

Call date.getUTCHours. Start with this line.

JavaScript
date.getUTCHours()
CallWhat it does
date.getUTCHours()Primary signature.
date.getUTCHours(...)Call with the arguments your case needs.

Built into JavaScript. Call getUTCHours(...) on a Date instance — no import required.

Library declarations
JavaScript
date.getUTCHours()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The value returned by date.getUTCHours().

JavaScript Examples

Example 1 — Read the UTC Hour

Build a UTC instant with Date.UTC, then call getUTCHours().

JavaScript
const d = new Date(Date.UTC(2026, 2, 15, 14, 30, 0)); // 14:30 UTC

console.log(d.getUTCHours()); // 14
Try It Yourself

How It Works

  1. Build a UTC time. Date.UTC(2026, 2, 15, 14, 30, 0) is March 15, 2026 at 14:30 UTC.
  2. Wrap it in Date. new Date(...) stores that instant.
  3. Read the UTC hour. getUTCHours() returns 14 (2 PM UTC).
  4. No side effects. The Date is unchanged; getUTCHours only reads.

Example 2 — Opposite Offsets, Different UTC Hours

Same wall-clock label with GMT+11 vs GMT-11 maps to different UTC hours.

JavaScript
const date1 = new Date("December 31, 1975, 23:15:30 GMT+11:00");
const date2 = new Date("December 31, 1975, 23:15:30 GMT-11:00");

console.log(date1.getUTCHours()); // 12
console.log(date2.getUTCHours()); // 10
Try It Yourself

How It Works

  1. Parse with an offset. Each string includes a timezone offset in the text.
  2. GMT+11 case. Subtract 11 hours from 23:15 → UTC hour 12.
  3. GMT−11 case. Add 11 hours to 23:15 → UTC hour 10 (next calendar day).
  4. Lesson. The same “23:15” label is not always UTC hour 23 — use getUTCHours() when UTC is the contract.

Example 3 — Check a UTC Business Window

Treat hours 9–16 UTC as “open” for a simple schedule check.

JavaScript
function isUtcOpen(date) {
  const h = date.getUTCHours();
  return h >= 9 && h < 17;
}

console.log(isUtcOpen(new Date(Date.UTC(2026, 0, 5, 10, 0, 0)))); // true
console.log(isUtcOpen(new Date(Date.UTC(2026, 0, 5, 18, 0, 0)))); // false
Try It Yourself

How It Works

  1. Read the UTC hour. getUTCHours() gives 0–23.
  2. Define the window. Open when hour is at least 9 and less than 17.
  3. 10:00 UTC. Inside the window → true.
  4. 18:00 UTC. Outside the window → false.

Browser & Runtime Support

Date.prototype.getUTCHours() has been in JavaScript since ES1. It is Baseline and works in every modern browser and Node.js — no polyfill needed.

✓ Baseline · ES1

Date.prototype.getUTCHours()

Supported everywhere Date exists: Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions.

99% Universal API
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Date.getUTCHours() Excellent

Bottom line: Safe to use in any environment. Focus on UTC vs local correctness. See also the MDN getUTCHours() reference.

Frequently Asked Questions

An integer from 0 to 23 for the hour in UTC. Midnight UTC is 0, noon is 12, and 11 PM UTC is 23. It does not return AM/PM labels.
getUTCHours() uses UTC. getHours() uses the local timezone. They often differ by your offset, and can even fall on different calendar days.
No. It always returns 24-hour values (0–23). Convert to 12-hour display yourself or use Intl.DateTimeFormat with timeZone: "UTC".
NaN. Validate with Number.isNaN(date.getTime()) before using the result.
Midnight UTC is 0. There is no hour 24 — 23 is the last hour of the UTC day.
Use getUTCHours() for UTC schedules, APIs, and shared server logic. Use getHours() for the user’s local clock hour.

Next: getUTCMilliseconds()

Learn how to read the milliseconds portion of a Date in UTC.

getUTCMilliseconds() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful