+ 5
I Need Countdown Timer
This countdown show to me my coming up next birthday, in months, weeks hr min sc etc. I want a counter timer that tells me how much time has passed from my birthday to the next birthday... When the next birthday comes, the countdown will automatically start from zero and continue until the next birthday. https://code.sololearn.com/WaKUPUc4By5Q/?ref=app
5 ответов
+ 7
// You need to change the the distance to:
var distance = now - countDownDate;
+ 4
I think more easier is to write it with a few new html tags and some additional css.
+ 2
#JaScript thanks...
How to i add a css .class or id in <style> </style> ?
Who added in jascript?
+ 2
https://code.sololearn.com/WaKUPUc4By5Q/?ref=app
Please check again i added a comment.
+ 2
After you define distance you need a check to see if the date has already passed. Here's a very crude example:
if (distance<0) countDownDate = new Date("June 12 "+(year+1)+", 12:00:00").getTime();
Note: If you weren't really born at noon and just want to count down to the day of your birthday, you should use 00:00 for the time.