<?php
/*
Function takes in seconds and will
display it on the most highest level
Automatically
*/
function showSecond($getCount)
{
if($getCount < 60){ return array($getCount,'Seconds');}
if($getCount/60 < 60){
// Difference in Minutes
return array(floor($getCount/60),'Minutes');
}
if($getCount/60/60 < 24){
// Difference in Hours
return array(floor($getCount/60/60),'Hours');
}
if($getCount/60/60/24 < 30){
// Difference in Days
return array(floor($getCount/60/60/24),'Days');
}
if($getCount/60/60/24/7 < 4){
// Difference in Weeks
return array(floor($getCount/60/60/24/7),'Weeks');
}
if($getCount/60/60/24/7/4 < 12){
// Difference in Months
return array(floor($getCount/60/60/24/7/4),'Months');
}
// Difference in Years
return array(number_format($getCount/365/60/60/24,4),'Years');
}
?>
|