JavaScript how to get tomorrows date in format dd-mm-yy [duplicate]

This should fix it up real nice for you.

If you pass the Date constructor a time it will do the rest of the work.

24 hours 60 minutes 60 seconds 1000 milliseconds

var currentDate = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
document.write("<b>" + day + "https://stackoverflow.com/" + month + "https://stackoverflow.com/" + year + "</b>")

One thing to keep in mind is that this method will return the date exactly 24 hours from now, which can be inaccurate around daylight savings time.

Phil’s answer work’s anytime:

var currentDate = new Date();
currentDate.setDate(currentDate.getDate() + 1);

The reason I edited my post is because I myself created a bug which came to light during DST using my old method.

Leave a Comment