Jump to content

time explained


rarebit

Recommended Posts

Is this correct, is there a built in way...

function time_since($t)
{
$secs = $t % 60;
$mins = floor(($t % 3600)/60);
$hours = floor(($t % 86400)/3600);
$days = floor(($t % 604800)/86400);
$weeks = floor(($t % 31449600)/604800);
$years = floor($t / 31449600);

print "secs: ".$secs."<br>";
print "mins: ".$mins."<br>";
print "hours: ".$hours."<br>";
print "days: ".$days."<br>";
print "weeks: ".$weeks."<br>";
print "years: ".$years."<br>";
}
time_since(225011227);

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/139357-time-explained/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.