Location: PHPKode > scripts > Multi-format countdown > example.php
<?php
/************************************************************* 
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com 
 * Fee free to distribute and modify code, but keep reference to its creator 
 * 
 * Multi format countdown class can convert time left from any combination of 
 * time units as seconds, minutes, hours, days, weeks, months and years to  
 * any other combinations of time units. 
 * 
 * For more information, examples and online documentation visit:  
 * http://webcodingeasy.com/PHP-classes/Generate-countdown-in-any-format 
**************************************************************/

include("countdown.php");

//2 years 2 months 1 week 5 days 20 hours 30 minutes 40 seconds
//from Sun, 10 Apr 2011 00:09:20 +0300
//provided value in seconds
$cd = new countdown(array("s"=>69539440), 1302383360);
echo "<pre>";
//get in years, months, weeks, days, hours, minutes and seconds
print_r($cd->get());
echo "</pre>";

//114 weeks 6 days 1230 minutes 40 seconds
//from now
//provided value in weeks, days, minutes, seconds
$cd = new countdown(array("w" => 114, "d" => 6, "i" => 1230, "s" => 40));
echo "<pre>";
//get in seconds
print_r($cd->get(array("s")));
echo "</pre>";

//80 seconds
//from now
//provided value in seconds
$cd = new countdown(array("s" => 80));
echo "<pre>";
//get in minutes (returns only full minutes)
print_r($cd->get(array("i")));
echo "</pre>";
?>
Return current item: Multi-format countdown