timer which will stop at specific time
I want to do a timer which will countdown starting from 8AM EST and finish at 6PM EST. Once the timer is at 00:00:00, I want to hide the control from the website, and then display again the next day at the same time. Any idea how I can achieve this? Tha开发者_Python百科nks in advance
Timers in JavaScript run in millisecond increments, so you need to figure out the number of milliseconds to the countdown time.
Formatting times and dates in JavaScript are a bit of a pain, luckily there are a few utilities like date.js that can help.
You'll need a timer that runs in 1000ms intervals (1 second) that will tick down your displayed date. You'll also need to compare the current date/time to the times you want to hide/show your counter. Date.js can help with this too.
精彩评论