JavaScript Date getDay() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.getDay() returns the day of the week as an integer 0–6 in local time, where 0 is Sunday and 6 is Saturday. It is read-only and does not change the Date.

Remember
date.getDay()

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

→ NaN if the Date is invalid

getDay()  → weekday index
getDate() → day of month (1–31)

Syntax

Call date.getDay. Start with this line.

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

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

Library declarations
JavaScript
date.getDay()

Parameters

ParameterDescription
Name mappingOptional. Array index or Intl for display labels

Return Value

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

JavaScript Examples

Example 1 — Read the Weekday Index

Call getDay() on a fixed local date (month index is zero-based).

JavaScript
const birthday = new Date(1975, 7, 19); // Aug 19, 1975

console.log(birthday.getDay()); // 2  (Tuesday)
Try It Yourself

How It Works

  1. Build a local date. new Date(1975, 7, 19) is August 19, 1975 (month index 7).
  2. Read the weekday. getDay() returns 2 — Tuesday in the 0–6 scale.
  3. Scale reminder. 0 = Sunday, so Tuesday lands at 2.
  4. No side effects. The Date is unchanged; getDay only reads.

Example 2 — Map the Index to a Weekday Name

Use the return value as an index into a names array (common teaching pattern).

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

const xmas = new Date(1995, 11, 25); // Dec 25, 1995
const index = xmas.getDay();

console.log(index);           // 1
console.log(dayNames[index]); // "Monday"
Try It Yourself

How It Works

  1. List the seven names. Index 0 must be Sunday to match getDay().
  2. Read the index. Christmas 1995 is a Monday → getDay() is 1.
  3. Look up the label. dayNames[1] → "Monday".
  4. For real i18n. Prefer Intl.DateTimeFormat with { weekday: "long" } instead of a hard-coded English array.

Example 3 — Weekend Check

Treat Sunday (0) and Saturday (6) as the weekend.

JavaScript
function isWeekend(date) {
  const day = date.getDay();
  return day === 0 || day === 6;
}

console.log(isWeekend(new Date(2026, 0, 3))); // true  (Sat)
console.log(isWeekend(new Date(2026, 0, 5))); // false (Mon)
Try It Yourself

How It Works

  1. Read the weekday. getDay() gives 0–6.
  2. Test the ends. Weekend = Sunday (0) or Saturday (6).
  3. Jan 3, 2026. Saturday → true.
  4. Jan 5, 2026. Monday → false.

Browser & Runtime Support

Date.prototype.getDay() 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.getDay()

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

Bottom line: Safe to use in any environment. Focus on Sunday-first indexing and local vs UTC correctness. See also the MDN getDay() reference.

Frequently Asked Questions

An integer from 0 to 6 for the weekday in local time: 0 is Sunday, 1 is Monday, … 6 is Saturday. It returns a number, not a name string.
getDay() returns the weekday index (0–6). getDate() returns the day of the month (1–31). Remember: Day = weekday, Date = calendar number.
getDay() uses the local timezone. getUTCDay() uses UTC. Near midnight they can differ by one weekday across timezones.
ECMAScript follows a long-standing convention where Sunday is index 0. Map the number to labels yourself, or use Intl.DateTimeFormat for locale-aware weekday names.
NaN. Validate with Number.isNaN(date.getTime()) before using the result in conditions or array lookups.
const day = date.getDay(); const isWeekend = day === 0 || day === 6; // Sunday or Saturday. Weekdays are day >= 1 && day <= 5.

Next: getFullYear()

Learn how to read the four-digit year from a Date in local time.

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