How to get tomorrow's date using JavaScript
By Flavio Copes
Learn how to get tomorrow's date in JavaScript by taking a Date and calling setDate() with getDate() plus 1, then optionally resetting time with setHours().
To get tomorrow’s date in JavaScript, copy today’s date into a new Date object and call setDate() passing getDate() + 1. The Date object handles the month and year rollover for you.
I had this problem the other day, and this is the solution I ended up with:
const today = new Date()
const tomorrow = new Date(today)
tomorrow.setDate(tomorrow.getDate() + 1)
Let’s break it down.
getDate() returns the day of the month, a number from 1 to 31. setDate() sets it. So setDate(getDate() + 1) moves the date forward by one day.
tomorrow is now a Date object representing tomorrow’s date. The time did not change. It’s still the time you ran the code, increased by 24 hours.
If you also want to reset the time to “tomorrow at 00:00:00”, call tomorrow.setHours(0, 0, 0, 0).
Why copy the date first?
Notice the new Date(today) in the middle. That line creates a copy of the date.
setDate() mutates the object you call it on. Without the copy, you’d be moving today forward instead, and any code still using that variable would now think today is tomorrow. Cloning first keeps both dates intact.
What about the end of the month?
You might worry about calling this on the 31st. Won’t setDate(32) produce an invalid date?
No. When the value is bigger than the days in the month, the Date object rolls over to the next month. It rolls over the year too:
const today = new Date('2026-01-31')
const tomorrow = new Date(today)
tomorrow.setDate(tomorrow.getDate() + 1)
// Feb 01 2026
const nye = new Date('2026-12-31')
const first = new Date(nye)
first.setDate(first.getDate() + 1)
// Jan 01 2027
February works too, including leap years. February 28, 2026 rolls to March 1, since 2026 is not a leap year.
Be careful with the milliseconds shortcut
You might be tempted to add a day’s worth of milliseconds instead:
const tomorrow = new Date(Date.now() + 24 * 60 * 60 * 1000)
This works most of the year, then breaks twice. On the days when daylight saving time starts or ends, the day is 23 or 25 hours long, so the result lands an hour off, and near midnight that means the wrong date.
setDate() works on the calendar, not on elapsed time, so it handles those days correctly. Stick with it.
Related posts about js: