Having the countdown treat a day as midnight-to-midnight | Peter's Date Countdown | Forum
Back to the date countdown plugin page
This is a question I got via e-mail:
I can’t get the countdown to show actual “sleeps” per se. In other words.. I think you are defining sleeps as every 24 hours?? And as such, I have one event at 6pm on the 10th and one event the following morning at 8am yet they both show the same number of winks or sleeps.
My website is http://www.hotforwords.com lower right corner you’ll see the countdown.
Is there something I can tweak to have the winks related to say before and after midnight?
Will you be using countdowns by day only ($showhours and $showminutes settings as “false”)? If so, you can find this code:
$remain = $dc_timestamp - (time() + $timediff * 3600);
And replace the $remain line with this:
Also, find this code:
$remain = ceil($remain / 86400);
And replace the $remain line with this:
The two changes above should treat all dates as if they occur at midnight the same day, while still displaying them as the correct time:
In other words, suppose your event was on a Sunday at 8pm. On Saturday at 11pm, it says “1 day remaining”. On Sunday at 12:01am it will display “0 days remaining”.
If you also want to have hourly and minute countdowns, then it gets more complicated with a bit more tweaking…