Created 03/2001; Updated April 2002 and December 2005
Super Simple Countdown in PHP.
Result:
- The date is Saturday, 22nd of February 2025 2:46:28 PM.
- It is 312 days until New Year's Eve, 2025.
- It is 7,496 hours until New Year's Eve, 2025.
Source Code:
<?php
$day = 31; // Day of the countdown
$month = 12; // Month of the countdown
$year = date("Y"); // Year of the countdown
$hour = 23; // Hour of the day
$event = "New Year's Eve, " . date("Y"); //event
$calculation = ((mktime($hour, 0, 0, $month, $day, $year) - time()) / 3600);
$hours = (int)$calculation;
$days = (int)($hours / 24);
?><h2>Result:</h2>
<ul>
<li>The date is <?php print (date("l, jS \of F Y g:i:s A")); ?>.</li>
<li>It is <?php print $days ?> days until <?php print $event ?>.</li>
<li>It is <?php print number_format($hours) ?> hours until <?php print $event ?>.</li>
</ul>