PHP – Countdown Script

< ?

$day = 16; // Day
$month = 7; // Month
$year = 2001; // Year

if ($month == 1) $month_name= "January";
if ($month == 2) $month_name= "February";
if ($month == 3) $month_name= "March";
if ($month == 4) $month_name= "April";
if ($month == 5) $month_name= "May";
if ($month == 6) $month_name= "June";
if ($month == 7) $month_name= "July";
if ($month == 8) $month_name= "August";
if ($month == 9) $month_name= "September";
if ($month == 10) $month_name= "October";
if ($month == 11) $month_name= "November";
if ($month == 12) $month_name= "December";

print ("There are " . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400) . " days until & $month_name $day, $year");

?>


or class version

http://elouai.com/countdown-clock.php

Countdown Calendar output:
Today’s date September 15, 2009, 5:25 am
Countdown date January 1, 2010, 12:00 am
Countdown 107 days 19 hours 34 minutes left

Countdown Calendar Usage

usage is simple, either cut and paste or include the countdown clock in your own scripts.

i.e. An example of a Countdown to New Year 2010!
<?php
include ‘countdown.php’;
// countdown to New Year 2010
countdown(2010,1,1,0,0,0);
?>

Leave a comment