today tomorrow day after tomorrow button html and javascript code example
Example: today tomorrow day after tomorrow button html and javascript
const tomorrow = new Date()
// add 1 day to today
tomorrow.setDate(new Date().getDate() + 1)
console.log(tomorrow)
const dayAfterTomorrow = new Date()
// add 2 day to today
dayAfterTomorrow.setDate(new Date().getDate() + 2)
console.log(dayAfterTomorrow)
//A date instance in JavaScript provides a .setDate() method to set the day of the month. A goody provided by this method: it automatically switches the month in case you’re exceeding the days in a month.
//At first, you need “today” as a reference. Use the new Date() constructor to create a date instance of today. Then, retrieving the day of tomorrow is a calculation of adding one day to the current day of the month using. You can retrieve the day of “today” using the .getDate() method.