You could always do something like this:
<?php
$curr = time();
$date = strtotime("August 07, 2014");
$diff = $date - $curr;
$diff_dd = floor($diff / 86400);
$diff %= 86400;
$diff_hh = floor($diff / 3600);
$diff %= 3600;
$diff_mm = floor($diff / 60);
$diff %= 60;
$diff_ss = $diff;
echo "Current date: " . date("Y-m-d H:i:s", $curr) . "n";
echo "Target date: " . date("Y-m-d H:i:s", $date) . "n";
echo sprintf(
"%d days, %d hours, %d minutes, %d seconds remaining",
$diff_dd,
$diff_hh,
$diff_mm,
$diff_ss
);
?>
Or something more simple:
<?
$day = 31; // Day of the countdown
$month = 12; // Month of the countdown
$year = 2014; // Year of the countdown
$hour = 23; // Hour of the day (east coast time)
$event = "New Year's Eve, 2014"; //event
$calculation = ((mktime ($hour,0,0,$month,$day,$year) - time(void))/3600);
$hours = (int)$calculation;
$days = (int)($hours/24);
/*
mktime() http://www.php.net/manual/en/function.mktime.php
time() http://www.php.net/manual/en/function.time.php
(int) http://www.php.net/manual/en/language.types.integer.php
*/
?>
<ul>
<li>The date is <?=(date ("l, jS of F Y g:i:s A"));?>.</li>
<li>It is <?=$days?> days until <?=$event?>.</li>
<li>It is <?=$hours?> hours until <?=$event?>.</li>
</ul>