3 Efficient ways to get tomorrow date using javascript

In this article, we will see some of the efficient ways to get tomorrow date using javascript.

Knowing how to play with date is important in javascript application development. because, it is one of the common scenarios you will face in application development.

Recent Article

How to Integrate Google sheet in nodejs Application Kubernetes for Nodejs developers

Tomorrow date in javascript

Let's see some of the easy way to get tomorrow's date using javascript and some external libraries in javascript

Built-in Method

Here, we are going to use a built in Date method to get tomorrow's date in javascript.

new Date() returns the current date in javascript. Also, the getDate method in javascript returns the current date value(1-31).

we are going to increment that value and use function setDate to get tomorrow's date.

1const today = new Date()
3// to return the date number(1-31) for the specified date
4console.log("today => ",today)
6let tomorrow = new Date()
7tomorrow.setDate(today.getDate() + 1)
8//returns the tomorrow date
9console.log("tomorrow => ",tomorrow)

tomorrow date in javascript


After that, we are going to use momentjs to get tomorrow date in javascript.

Let's install momentjs in our project using the command,

1npm i moment

Now, you can get the current date using moment instance inside your project.

1const todayMoment = moment() //returns the current date with moment instance.

To get tomorrow date, you just need to add +1 days to the today moment instance.

1const tomorrowMoment = todayMoment.clone().add(1,'days')

Here, we clone the todayMoment instance. because moment instance are mutable. it's always better the clone it before manipulating it.

tomorrow date

Date Fns

Now, we will see how to get tomorrow date using date-fns. it is so simple to get the date using date-fns.

1const tomorrowFns = add(new Date(),{
2 days: 1

Using, we can add days,month and year easily.

1var result = add(new Date(2020, 8, 1, 10, 19, 50), {
2 years: 2,
3 months: 9,
4 weeks: 1,
5 days: 7,
6 hours: 5,
7 minutes: 9,
8 seconds: 30,

tomorrow date


We can use any one method depends upon the requirement. if you don't want to install an library, you can go with javascript in-built method to solve the problem.

To Read More

Building Nodejs Microservice - A Cl...

This Article explains everything about how to build Nodejs Microservices in clou...

I Accidentally wiped the entire dat...

One of the tragic accident in my job turned out to be good learning for me in re...

List of Docker Container Commands y...

This article covers list of commands that you should know to manage docker conta...