Php - countdown timer getting jquery value
I can advise. I have the following table:
The date in the upper left corner is reflected from the database.
I would like to add a countdown timer to match the days, I have a lot of games that take place over several days.
I need to try to find a way to integrate a countdown timer using php, or pass a date value to my jquery script.
I am just looking for logic or advice to solve this problem.
thank
Personally, I divided the time into hours / minutes / seconds and passed them separately to jQuery. In this example , I can define minutes and seconds separately;
iMins = <?php define it here ?>,
iSecs = <?php define here ?>;
This example can be modified so that the function countDown()
points to an element each time to start multiple timers.
You want the echo php variable to use some kind of Javascript countdown timer using:
var dateInJavascript = '<?php echo($dateFromDatabase); ?>';
For example, you can use one of the many javascript countdown timers -
http://www.gieson.com/Library/projects/utilities/countdown/
Or you could implement this lovely stack entry -
The simplest possible JavaScript countdown timer?
Try this js function, its easy to make a countdown timer:
https://github.com/aneeshikmat/timeDownCounter
Exampleafter including timeDownCounter.js:
timeDownCounter({
'countDownIdSelector': 'time-down-counter',
'countDownDate': new Date("Sep 5, 2018 15:37:25").getTime(),
'countDownResSperator': '-'
'countDownReturnData': 'from-hours',
'addSpanForResult': true,
'addSpanForEachNum': true,
'contDownOver': 'Time is expired, and you can say hello now :P',
'getTemplateResult': 0
}).startCountDown();