Location: PHPKode > scripts > CountDown PHP Script > example.php
<?php
// First include the class file and make a new object
include("countdown.class.php");
$CountDown = new CountDown;

// The following piece of code will make a countdown until March 29th 2010 at 8 PM. (Local server time)
$out = $CountDown->Give(20,0,0,5,29,2010);
echo "March 29th 2010, 20:00 - ".$out;

// The next code will set a different format for the countdown.
// You can use the following replacement strings:
//   {W}   This is the number of weeks
//   {Ws}  Either an 's' or nothing. Use as {W} week{Ws} in case it's 1 week, and not 1 weeks.
//   {D}   Number of days
//   {Ds}  Same as {Ws} but for days
//   {H}   Number of hours
//   {Hs}  Same as {Ws} but for hours
//   {M}   Number of minutes
//   {Ms}  Same as {Ws} but for minutes
$CountDown->format = "Weeks: {W}<br />Days: {D}<br />Hours: {H}";
$out = $CountDown->Give(20,0,0,5,29,2010);
echo $out;

// And the last setting is the use of the message that the countdown reached it's destination time.
$CountDown->finished = "Happy new year!";
$CountDown->format = "New year 2011!<br />Weeks left: {W}<br />Days left: {D}<br />Hours left: {H}<br />Minutes left: {M}";
$out = $CountDown->Give(0,0,1,1,1,2011);
echo $out;
?>
Return current item: CountDown PHP Script