JavaScript Date getUTCDay() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
UTC weekday (0–6)

What You’ll Learn

getUTCDay() returns the day of the week (0–6) from a Date object in UTC. This guide covers syntax, the Sunday–Saturday index table, five examples, comparisons with local getters, and safe UTC scheduling patterns.

01

Syntax

date.getUTCDay()

02

Range

0 – 6

03

UTC

Not local

04

vs getUTCDate

Week vs month

05

Names

Map index

06

Validate

Invalid → NaN

Introduction

Global apps often bucket data by UTC weekdays—for example, “reporting week starts on UTC Monday.” The JavaScript Date object stores one instant; getUTCDay() reads the weekday index according to UTC, not the user’s local timezone.

If you need the weekday in the user’s locale, use getDay() or Intl.DateTimeFormat. Use getUTCDay() when your logic follows UTC calendar boundaries.

Understanding the getUTCDay() Method

Date.prototype.getUTCDay() is a zero-argument instance method. It never mutates the original Date—it only reads the UTC weekday component.

The return value is always an integer: 0 = Sunday through 6 = Saturday. To show a name, map the index to a string array or use locale formatters with timeZone: "UTC".

💡
Beginner Tip

Memory hook: getUTCDay = UTC weekday (Monday / 1). getUTCDate = UTC calendar date number (15th). The “Day” vs “Date” pattern matches the local getters.

📝 Syntax

JavaScript
dateObj.getUTCDay()

Parameters

  • None.

Return value

  • Integer 0–6 for a valid date in UTC (0 = Sunday).
  • NaN if dateObj is an invalid Date.

Weekday index table

  • 0 — Sunday
  • 1 — Monday
  • 2 — Tuesday
  • 3 — Wednesday
  • 4 — Thursday
  • 5 — Friday
  • 6 — Saturday

⚡ Quick Reference

GoalCode
Current UTC weekday indexnew Date().getUTCDay()
Weekday from UTC partsnew Date(Date.UTC(2024, 1, 26)).getUTCDay() → 1
Local weekday indexdate.getDay()
UTC day of monthdate.getUTCDate()
UTC weekend checkconst d = date.getUTCDay(); d === 0 || d === 6
Valid date check!Number.isNaN(date.getTime())

📋 getUTCDay() vs Similar Methods

UTC getters mirror local getters. Pick the one that matches where your data is displayed or stored.

getUTCDay()
0–6

UTC weekday

getDay()
local

Local weekday

getUTCDate()
1–31

UTC day of month

Intl + UTC
"Monday"

Localized name

Examples Gallery

Open DevTools Console (F12) or use Try-it links. Fixed UTC dates use Date.UTC or ISO strings ending in Z for predictable results.

📚 Getting Started

Read the UTC weekday index from a known calendar date.

Example 1 — Get the UTC Weekday Index from a Fixed Date

February 26, 2024 is a Monday in UTC—getUTCDay() returns 1.

JavaScript
const feb26Utc = new Date(Date.UTC(2024, 1, 26));
const dayOfWeek = feb26Utc.getUTCDay();

console.log(dayOfWeek); // 1 (Monday)
Try It Yourself

How It Works

Date.UTC builds a UTC timestamp. getUTCDay() ignores local timezone—every user running this code gets 1 for that instant.

📈 Practical Patterns

Name mapping, validation, weekend checks, and local comparison.

Example 2 — Map the UTC Index to a Weekday Name

Turn the numeric result into a readable English label.

JavaScript
const WEEKDAYS = [
  "Sunday", "Monday", "Tuesday", "Wednesday",
  "Thursday", "Friday", "Saturday"
];

function getUtcDayName(date) {
  return WEEKDAYS[date.getUTCDay()];
}

const sample = new Date(Date.UTC(2024, 1, 26));
console.log("UTC weekday:", getUtcDayName(sample));
// UTC weekday: Monday
Try It Yourself

How It Works

Array index aligns with getUTCDay()—index 0 is Sunday. For production i18n, use Intl.DateTimeFormat("en-US", { weekday: "long", timeZone: "UTC" }).

Example 3 — Validate Before Calling getUTCDay()

Guard against invalid Date objects that yield NaN.

JavaScript
function safeGetUTCDay(date) {
  if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
    return null;
  }
  return date.getUTCDay();
}

console.log(safeGetUTCDay(new Date()));              // e.g. 5
console.log(safeGetUTCDay(new Date("not-a-date"))); // null
Try It Yourself

How It Works

getTime() returns NaN on invalid dates. Checking first prevents WEEKDAYS[NaN] from silently returning undefined in UI code.

Example 4 — Check for a UTC Weekend

Run weekend logic when the UTC weekday is Sunday (0) or Saturday (6).

JavaScript
// Saturday, Feb 24, 2024 UTC
const saturdayUtc = new Date(Date.UTC(2024, 1, 24));
const day = saturdayUtc.getUTCDay();

if (day === 0 || day === 6) {
  console.log("UTC weekend");
} else {
  console.log("UTC weekday");
}
Try It Yourself

How It Works

Global batch jobs often skip UTC weekends for maintenance windows. Use getUTCDay(), not getDay(), when the rule is defined in UTC.

Example 5 — Compare getDay() and getUTCDay()

Near UTC midnight, local and UTC weekdays can differ.

JavaScript
// Jan 31, 2026 at 23:30 UTC (Saturday in UTC)
const date = new Date("2026-01-31T23:30:00.000Z");

console.log("UTC weekday:", date.getUTCDay());   // 6
console.log("Local weekday:", date.getDay());    // depends on timezone
Try It Yourself

How It Works

At 23:30 UTC on Saturday Jan 31, it is already Sunday in UTC+5:30. getUTCDay() stays 6 (Saturday); getDay() becomes 0 (Sunday). Pick the getter that matches your business rule.

🚀 Common Use Cases

  • UTC cron jobs — run tasks only on specific UTC weekdays.
  • Global analytics — bucket events by UTC weekday index.
  • Maintenance windows — skip UTC Saturday/Sunday deploys.
  • API logs — label timestamps with UTC weekday for support.
  • Recurring UTC events — “every UTC Tuesday” logic.
  • Debug panels — show local and UTC weekday side by side.

🧠 How getUTCDay() Resolves the Weekday

1

Internal instant

The Date stores milliseconds since Unix epoch (UTC).

Storage
2

UTC projection

Engine reads calendar fields in UTC, not local time.

UTC
3

Extract weekday

UTC day-of-week index 0–6 is returned as an integer.

getUTCDay
4

Use in logic

Map to names, branch on weekends, or compare with local getters.

📝 Notes

  • getUTCDay() is UTC; use getDay() for local UI rules.
  • Do not confuse with getUTCDate() (day of month 1–31).
  • Sunday is 0, not 7.
  • Invalid dates propagate NaN—validate with Number.isNaN(date.getTime()).
  • Locale first-day-of-week settings do not change the numeric index—only how you label it.
  • For localized weekday names in UTC, use Intl.DateTimeFormat with timeZone: "UTC".

Browser & Runtime Support

Date.prototype.getUTCDay() has been available since the first JavaScript Date implementation (ES1). It works in every browser and Node.js.

Baseline · ES1

Date.prototype.getUTCDay()

Supported in Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions. No polyfill required.

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.getUTCDay() Excellent

Bottom line: Safe everywhere. Use UTC getters together for global rules; use local getters when showing dates to end users.

Conclusion

getUTCDay() reads the weekday index from a JavaScript Date in UTC. Map the 0–6 result to names, distinguish it from getUTCDate(), and choose UTC vs local getters based on your scheduling rules.

Next, learn getUTCFullYear() for the UTC year component, or review getDay() for local weekday logic.

💡 Best Practices

✅ Do

  • Validate dates before calling getUTCDay()
  • Use UTC getters for global batch and cron rules
  • Map 0–6 to labels or use Intl with UTC timezone
  • Pair with Date.UTC in tests for stable fixtures
  • Document whether rules follow UTC or local time

❌ Don’t

  • Confuse getUTCDay with getUTCDate
  • Assume getDay() equals getUTCDay()
  • Use index 7 for Sunday
  • Ignore NaN from bad date parses
  • Mix local and UTC getters in one scheduling rule

Key Takeaways

Knowledge Unlocked

Five things to remember about Date.getUTCDay()

Your foundation for UTC weekday reads in JavaScript.

5
Core concepts
🔢 02

0–6

Sun = 0.

Range
🌐 03

UTC

Not local.

Timezone
📅 04

Not getUTCDate

Week vs date.

Pitfall
🔄 05

Weekend

0 or 6.

Pattern

❓ Frequently Asked Questions

An integer from 0 to 6 representing the day of the week in UTC. 0 is Sunday, 1 is Monday, … 6 is Saturday. It returns an index, not a name string.
getUTCDay() returns the weekday index (0–6). getUTCDate() returns the day of the month (1–31). Remember Day = weekday, Date = calendar date number—the same naming pattern as the local getters.
getUTCDay() uses UTC rules. getDay() uses local timezone rules. Near midnight or across timezones they can differ by one day.
Historical ECMAScript convention follows US-style calendars where Sunday is index 0. Map the number to labels yourself or use Intl.DateTimeFormat with timeZone: 'UTC' for locale-aware weekday names.
NaN. Validate with Number.isNaN(date.getTime()) before using the result in conditionals or array lookups.
const day = date.getUTCDay(); const isWeekend = day === 0 || day === 6; // Sunday or Saturday in UTC.
Did you know?

At 2026-01-31T23:30:00.000Z, getUTCDay() is always 6 (Saturday), but getDay() can be 0 (Sunday) in timezones ahead of UTC—the same instant, different weekday labels.

Continue to getUTCFullYear()

Learn how to read the four-digit year component from a Date in UTC.

getUTCFullYear() 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.

6 people found this page helpful