Call getDate() on a Date object and you’ll get the day of the month as a number from 1 to 31. That one method is all TypeScript needs, because it uses the JavaScript Date type as is:
const day = new Date().getDate(); // 1-31
It returns the day in your computer’s local time zone, which matters more than you’d think.
In this tutorial, I’ll show you how to get day of month in TypeScript, avoid the time zone traps, and find the last day of a month.
I ran every example with TypeScript 7.0.2 and Node.js v22.22.2 in strict mode, on a machine set to US Eastern time.
How do I get the day of the month with getDate()?
Call getDate() on any Date. Here’s a fixed date, today’s date from getting the current date in TypeScript, and a small typed helper:
const deadline = new Date(2026, 10, 20); // month 10 = November
console.log("deadline day:", deadline.getDate());
const today = new Date();
console.log("today's day: ", today.getDate());
function getDayOfMonth(date: Date): number {
return date.getDate();
}
console.log("July 4: ", getDayOfMonth(new Date(2026, 6, 4)));
Output:
deadline day: 20
today's day: 20
July 4: 4

Remember that the month argument is zero-based, so 10 means November. I cover that quirk in creating a date from year, month and day in TypeScript.
getDate() vs getDay(): which one returns the day of the month?
getDate() gives the day of the month, while getDay() gives the day of the week (0 is Sunday):
const payday = new Date(2026, 10, 20);
console.log("getDate():", payday.getDate());
console.log("getDay(): ", payday.getDay());
const names = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
console.log(`${names[payday.getDay()]}, day ${payday.getDate()}`);
Output:
getDate(): 20
getDay(): 5
Fri, day 20
November 20, 2026 is a Friday, so getDay() prints 5 while getDate() prints 20.
Why does getDate() return the wrong day for an ISO date string?
A date-only string like "2026-03-01" is parsed as midnight UTC. In New York that moment is still February 28, so getDate() looks off by one:
const fromApi = new Date("2026-03-01"); // date-only = UTC midnight
console.log("getDate(): ", fromApi.getDate());
console.log("getUTCDate():", fromApi.getUTCDate());
console.log("local time: ", fromApi.toString());
const local = new Date("2026-03-01T00:00:00"); // no Z = local time
console.log("fixed: ", local.getDate());
Output:
getDate(): 28
getUTCDate(): 1
local time: Sat Feb 28 2026 19:00:00 GMT-0500 (Eastern Standard Time)
fixed: 1

getUTCDate() still reads March 1.Use getUTCDate() when the data is stored in UTC, or add a time without Z so it’s read as local. More on this in converting dates to UTC in TypeScript and converting a string to a date.
Get the day of the month in a specific time zone
If your users are spread across the US, read the day in their time zone with Intl.DateTimeFormat. The last line pads the day to two digits:
const launch = new Date("2026-11-21T04:30:00Z");
function dayIn(date: Date, timeZone: string): number {
const fmt = new Intl.DateTimeFormat("en-US", {
day: "numeric",
timeZone,
});
return Number(fmt.format(date));
}
console.log("New York: ", dayIn(launch, "America/New_York"));
console.log("Los Angeles:", dayIn(launch, "America/Los_Angeles"));
console.log("UTC: ", dayIn(launch, "UTC"));
const july4 = new Date(2026, 6, 4);
console.log("padded:", String(july4.getDate()).padStart(2, "0"));
Output:
New York: 20
Los Angeles: 20
UTC: 21
padded: 04

Padding with padStart(2, "0") gives you the 04 you need in MM/DD/YYYY strings. For complete patterns, see formatting a date with a time zone in TypeScript and formatting dates in TypeScript.
Get the last day of the month (days in a month)
Pass day 0 of the next month and JavaScript rolls back to the last day of the current one. Then getDate() tells you how many days the month has:
function daysInMonth(year: number, month: number): number {
return new Date(year, month + 1, 0).getDate(); // day 0 = last day
}
console.log("Feb 2026:", daysInMonth(2026, 1));
console.log("Feb 2028:", daysInMonth(2028, 1));
console.log("Nov 2026:", daysInMonth(2026, 10));
Output:
Feb 2026: 28
Feb 2028: 29
Nov 2026: 30

This trick pairs well with adding months to a date in TypeScript. For week boundaries instead, see the first and last day of the week.
Working on more date logic? Try one of these next:
- Calculate the days between two dates in TypeScript
- Get the week number from a date in TypeScript
- Check if a date is today in TypeScript
- Check for invalid dates in TypeScript
Frequently asked questions
How do I get the day of the month in TypeScript?
Call date.getDate(). It returns a number from 1 to 31 in local time.
What’s the difference between getDate() and getDay()?
getDate() is the day of the month (1-31); getDay() is the day of the week (0 for Sunday to 6 for Saturday).
Why is getDate() one day behind for “2026-03-01”?
Date-only ISO strings are parsed as UTC midnight, which is the previous evening in US time zones.
How do I get the number of days in a month?
Use new Date(year, month + 1, 0).getDate(), where month is zero-based.
Why does getDate() return NaN?
The date is invalid, for example new Date("next Friday"). Check Number.isNaN(date.getTime()) before reading the day.
Where is Date.prototype.getDate() documented?
See Date.prototype.getDate() on MDN.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn