Categories
JavaScript Answers

How to get date of the next day with JavaScript?

Spread the love

Sometimes, we want to get date of the next day with JavaScript.

In this article, we’ll look at how to get date of the next day with JavaScript.

How to get date of the next day with JavaScript?

To get date of the next day with JavaScript, we use the getDate and setDate methods.

For instance, we write

const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);

to create the tomorrow Date object with the current date and time.

Then we call getDate to get the current date.

And then we add 1 to it and use the sum as the argument for setDate to change tomorrow to tomorrow’s date.

Conclusion

To get date of the next day with JavaScript, we use the getDate and setDate methods.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *