PHP Code:
function whatDate($date1) {
$tots = time() - strtotime(str_replace("-","/",$date1));
if($tots>31536000) $tot = round($tots/31536000,0).' year';
else if($tots>2628000) $tot = round($tots/2628000,0).' month';
else if($tots>604800) $tot = round($tots/604800,0).' week';
else if($tots>86400) $tot = round($tots/86400,0).' day';
if($tot>1) $tot .= 's';
return $tot;
}
Alright what I want to do:
I want it to go up to 24 months and then start at 2 years x months // it currently goes to 12 months and then starts 1 year.. and then 2 years, no months
I want it to be like:
1 month
2 months
3 months
...
24 months
2 years
2 years 1 month
2 years 2 months
...
3 years 1 month
etc
can anyone show me how to do that? I am calculating in seconds by the way.. all I am doing is grabbing
2013-3-23 (yesterdays date for example)
and using the exact current time/date to just get how many seconds
I'm just confused on adding multiple things that output there
(how it looks with not bad colors)