DEV Community

Discussion on: Countdown Timer using HTML, CSS, and Javascript

shikkaba profile image

Sooooo if I wanted just a countdown timer like 10 minutes from now instead of a specific date, how would I achieve that?

divyamcm profile image
Divyamcm Author • Edited on

var offerDate = new Date('30 oct 2021')
Instead of the above format, you can use below format
new Date(year, month, day, hours, minutes, seconds, milliseconds) .
Ex: var offerDate = new Date(2021,09,16,09,20,0,0)

Set the values ten minutes ahead of current time to acheive 10 minutes countdown timer.