Categories
JavaScript Answers

How to get tomorrow’s date in format dd-mm-yy with JavaScript?

Spread the love

Sometimes, we want to get tomorrow’s date in format dd-mm-yy with JavaScript.

In this article, we’ll look at how to get tomorrow’s date in format dd-mm-yy with JavaScript.

How to get tomorrow’s date in format dd-mm-yy with JavaScript?

To get tomorrow’s date in format dd-mm-yy with JavaScript, we can use the date instance’s toLocaleDateString method.

For instance, we write

const d = new Date(2022, 1, 29);
console.log(d.toLocaleDateString());

to create date d with the Date constructor.

Then we call toLocaleDateString to return a human readable date string.

Conclusion

To get tomorrow’s date in format dd-mm-yy with JavaScript, we can use the date instance’s toLocaleDateString method.

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 *