Skip to content Skip to sidebar Skip to footer

Countdown Based On Mysql Entry

I have a database that logs the date and time a song was played in a format like 2011-04-13 17:55:46. It also logs the length of the song in milliseconds. How would I make a live c

Solution 1:

For Javascript, you can use the Date() object created from a string with the given time (you can print it to the screen in a hidden input, span, or whatever). I assume the end time is when the song ends. You can calculate this very simply based on the difference between the play time and the song length. When you say "refresh countdown," do you mean if they refresh the page? Well, I'm not sure how the song would keep playing at the given time, but you could check that the song was started and use the time you have above and do your calculation again.


Post a Comment for "Countdown Based On Mysql Entry"