Countdown to specific date in the future (hrs, min, sec)?

Is it possible to have a live countdown to a specific date in the future - something like:

Time left: 10h 24m 45s

Any pointers greatly appreciated…

3 Likes

This might help. Plenty of stuff about count down to this and that. These are for specific fixed days for the current year. Have a look and see how you get on.

2 Likes

Check also this thread: Halloween countdown

4 Likes

Hello @russellcresser, @tom.vannes - thanks so much for your seemingly infinite coding knowledge and sample resources - this is exactly what I was looking for!

Thanks again for all that you contribute to this forum and each and every user.

3 Likes

Quick question - when counting down days, hrs, min I found that the formular in the Halloween sample above counts one day too many. It counts the days correctly if we don’t add any additional time count. But given that we also count hrs and mins I changed the formular I use to:

$(45-#DD#)<0?45-(45-#DD#):((45-#DD#)-1)$

I added the -1 to show the correct number of days when including hrs & mins. I hope this is correct.

2 Likes

I think these things changed recently as Facer launched a Tag to give the Leap years. It had to be done long hand before. If you want it Leap Year Proof you will have to check the next 8 years or so. But most don’t bother.

1 Like

Hello @russellcresser - thanks for the note. I found that even if I calculate the time to Halloween this year the:

$(45-#DD#)<0?45-(45-#DD#):((45-#DD#)-1)$

the ‘-1’ in ((45-#DD#)-1) is needed if I add hrs., mins, secs - otherwise it counts an additional day - checked with Days Calculator.

2 Likes

I can not test right now but I think you conditional needs a = sign.

$(45-#DD#)<=0?45-(45-#DD#):((45-#DD#)-1)$

2 Likes

Thanks @russellcresser - yes, that is looks right!

2 Likes