Navigation


Display seconds in days to years

<?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/4){
        
// Difference in Weeks    
            
return array(floor($getCount/60/60/24/7),'Weeks');
    }
    if(
$getCount/60/60/24/7/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');
}

?>

Custom PHP

Need a custom script or changes to a current script? I am available for hire!


Donations Needed

Only through donations is this website kept alive. Donations help pay for hosting costs for my free scripts.

2010 Goal: $125
Current: $0.00

Please Donate, Every bit Helps.
$


Links