Wednesday 15 April 2015

Daily countdown ticker php -


Does anybody have an idea about how to make a countdown ticker that is a reasonable time of day and time And shows the minute a weekend (Saturn and Sun) remains on Monday until 16:30.

It has stumped me and can actually do this with some points.

Thanks, b.

If you want to count the page in each second, instead of refreshing it, you use javascript should do. There are many, and other javascript can be found by using Google search for countdowns

If you want to do it in PHP, then the Unix timestamp The best way to get, and by value.

Find the difference, and then you can calculate the remaining time:

  $ diff = mktime (...) - time (); $ Day = floor ($ diff / 60/60/24); $ Hour = floor (($ $ diff - $ days * 60 * 60 * 24) / 60/60);  

etc.

Edit

Javascript ...

Original Idea

var date = new Date (); // gets now var weekdays = date.getDay (); // Current day / Sunday is Sunday. 6 is Saturday (day of week == 0) {date.setTime () (date.getTime (+ 60 * 60 * 24); // Increase time of one day} if (day of week == 6) {date.setTime () (date.getTime (+ 60 * 60 * 24 * 2); // Increase time up to two days) // We already have to check that passes at 16:30, if ((date.getHours () == 16 and date.getMinutes ()> 30) || Date GetHours ()> 16) {// If we have, increase the date of the day .setTime () (date.getTime (+ 60 * 60 * 24)) date.setHours (16); Date.setMinutes (30); // Now the date is the time we want to count down, which we can use with a jquery plugin

No comments:

Post a Comment