JavaScript Date getUTCDate() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
UTC day of month

What You’ll Learn

getUTCDate() returns the calendar day of the month (1–31) from a Date object in UTC. This guide covers syntax, five examples, comparisons with local getters, and safe UTC date patterns.

01

Syntax

date.getUTCDate()

02

Range

1 – 31

03

UTC

Not local

04

vs getDate

Can differ

05

Add days

setUTCDate pair

06

Validate

Invalid → NaN

Introduction

Servers, databases, and APIs usually store instants in UTC. The JavaScript Date object stores one instant internally; UTC getters like getUTCDate() read calendar parts without applying your local timezone offset.

If you need the day in the user’s local timezone, use getDate() instead. Use getUTCDate() when you build UTC date strings or compare calendar days globally.

Understanding the getUTCDate() Method

Date.prototype.getUTCDate() is a zero-argument instance method. It never mutates the original Date—it only reads the UTC day-of-month component.

Pair it with getUTCMonth(), getUTCFullYear(), and getUTCHours() to assemble UTC parts, or use toISOString() when a full UTC string is enough.

💡
Beginner Tip

Memory hook: getUTCDate = UTC calendar date (15th). getUTCDay = UTC weekday (Tuesday / 2). The “Date” vs “Day” distinction matches the local getters.

📝 Syntax

JavaScript
dateObj.getUTCDate()

Parameters

  • None.

Return value

  • Integer 1–31 for a valid date in UTC.
  • NaN if dateObj is an invalid Date.

⚡ Quick Reference

GoalCode
Today’s UTC calendar daynew Date().getUTCDate()
UTC day from partsnew Date(Date.UTC(2026, 2, 15)).getUTCDate() → 15
Local calendar daydate.getDate()
UTC weekday (0–6)date.getUTCDay()
Add 7 UTC daysdate.setUTCDate(date.getUTCDate() + 7)
Valid date check!Number.isNaN(date.getTime())

📋 getUTCDate() vs Similar Methods

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

getUTCDate()
1–31

UTC day of month

getDate()
local

Local day of month

getUTCDay()
0–6

UTC weekday

toISOString()
…Z

Full UTC string

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 current UTC day-of-month from a new Date.

Example 1 — Get Today’s UTC Day of the Month

Call getUTCDate() on the current instant.

JavaScript
const now = new Date();
const utcDay = now.getUTCDate();

console.log("UTC day of month:", utcDay);
Try It Yourself

How It Works

The same Date instant can show a different calendar day locally vs UTC. getUTCDate() always uses the UTC calendar.

📈 Practical Patterns

Fixed UTC dates, validation, formatting, and local comparison.

Example 2 — Read a Specific UTC Calendar Day

Build a date with Date.UTC (month index 2 = March).

JavaScript
const march15Utc = new Date(Date.UTC(2026, 2, 15));

console.log(march15Utc.getUTCDate());      // 15
console.log(march15Utc.getUTCMonth());     // 2 (March)
console.log(march15Utc.getUTCFullYear());  // 2026
Try It Yourself

How It Works

Date.UTC creates a UTC timestamp. UTC getters read back the same parts you passed in, regardless of the user’s local timezone.

Example 3 — Validate Before Calling getUTCDate()

Guard against invalid Date objects that yield NaN.

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

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

How It Works

getTime() returns NaN on invalid dates. Checking first prevents displaying “UTC day NaN” in dashboards or logs.

Example 4 — Build a UTC YYYY-MM-DD String

Combine UTC getters for a date-only string (or prefer toISOString().slice(0, 10)).

JavaScript
function formatUtcDate(date) {
  const year = date.getUTCFullYear();
  const month = String(date.getUTCMonth() + 1).padStart(2, "0");
  const day = String(date.getUTCDate()).padStart(2, "0");
  return year + "-" + month + "-" + day;
}

const sample = new Date(Date.UTC(2026, 6, 4));
console.log(formatUtcDate(sample)); // 2026-07-04
Try It Yourself

How It Works

getUTCMonth() is zero-based like getMonth(), so add 1 before padding. For production APIs, toISOString() is usually simpler.

Example 5 — Compare getDate() and getUTCDate()

Near UTC midnight, local and UTC calendar days can differ.

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

console.log("UTC day:", date.getUTCDate());   // 31
console.log("Local day:", date.getDate());    // depends on timezone
Try It Yourself

How It Works

At 23:30 UTC on Jan 31, it is already Feb 1 in UTC+5:30. getUTCDate() stays 31; getDate() becomes 1. This is why server UTC dates and local UI dates must not be mixed blindly.

🚀 Common Use Cases

  • API payloads — assemble UTC date parts for logs or exports.
  • Global dashboards — align daily metrics on UTC midnight boundaries.
  • Database rows — read UTC day from timestamps stored as UTC.
  • Unit tests — assert UTC parts with Date.UTC fixtures.
  • Debug panels — show both local and UTC calendar days side by side.
  • UTC arithmetic — shift days with setUTCDate(getUTCDate() + n).

🧠 How getUTCDate() Resolves the Day

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 day

UTC calendar day-of-month (1–31) is returned as an integer.

getUTCDate
4

Use in APIs

Format, compare, or feed into setUTCDate for UTC day math.

📝 Notes

  • getUTCDate() is UTC; use getDate() for local UI labels.
  • Do not confuse with getUTCDay() (weekday index).
  • Invalid dates propagate NaN—validate with Number.isNaN(date.getTime()).
  • getUTCMonth() is zero-based; add 1 when building month numbers.
  • For full UTC strings, toISOString() is often simpler than manual getters.
  • Add UTC days with setUTCDate(getUTCDate() + n), not local setDate, when working in UTC.

Browser & Runtime Support

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

Baseline · ES1

Date.prototype.getUTCDate()

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

Bottom line: Safe everywhere. Pair UTC getters together and avoid mixing them with local getters on the same formatted output.

Conclusion

getUTCDate() reads the day-of-month from a JavaScript Date in UTC. Use it when your logic follows UTC calendar boundaries; use local getters or locale formatters when showing dates to end users.

Next, learn getUTCDay() for UTC weekday logic, or toISOString() for standard UTC output.

💡 Best Practices

✅ Do

  • Validate dates before calling getUTCDate()
  • Use UTC getters together for UTC formatting
  • Prefer Date.UTC in tests for stable fixtures
  • Use setUTCDate(getUTCDate() + n) for UTC day math
  • Store instants as UTC ISO or epoch on servers

❌ Don’t

  • Confuse getUTCDate with getUTCDay
  • Mix local and UTC getters in one label
  • Assume getDate() equals getUTCDate()
  • Forget zero-based getUTCMonth()
  • Ignore NaN from bad date parses

Key Takeaways

Knowledge Unlocked

Five things to remember about Date.getUTCDate()

Your foundation for UTC day-of-month reads in JavaScript.

5
Core concepts
🔢 02

1–31

UTC day of month.

Range
🌐 03

UTC

Not local.

Timezone
🔄 04

+ UTC days

setUTCDate idiom.

Math
05

Not getUTCDay

Month vs week.

Pitfall

❓ Frequently Asked Questions

An integer from 1 to 31 representing the day-of-month according to Coordinated Universal Time (UTC). It is the UTC calendar date, not the local calendar date.
getUTCDate() reads the UTC calendar day. getDate() reads the local calendar day. Near midnight or across timezones they can differ by one day.
getUTCDate() returns the day of the month (1–31). getUTCDay() returns the day of the week in UTC (0–6, where 0 is Sunday). Do not confuse Date with Day.
NaN. Validate with Number.isNaN(date.getTime()) before relying on the result.
For sending dates to servers, prefer toISOString() or store epoch milliseconds. Use getUTCDate() when you are assembling UTC parts manually or teaching how UTC getters work.
Use setUTCDate(getUTCDate() + n). Like setDate, it normalizes month and year overflow automatically in UTC.
Did you know?

At 2026-01-31T23:30:00.000Z, getUTCDate() is always 31, but getDate() can be 1 in timezones ahead of UTC—that one-line comparison is a classic timezone bug demo.

Continue to getUTCDay()

Learn how to read the day of the week in UTC with weekday indexes from 0 (Sunday) to 6 (Saturday).

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