$t = 1637544;
$d =sec2time ($t);
$d 0 years, 18 days, 22 hours, 52 minutes, 24 seconds.
Convert Seconds to time (year, day, hour, minute, second)
functionSec2time ($time){ if(Is_numeric($time)){ $value=Array( "Years" = 0, "days" = 0, "hours" = 0, "minutes" and "0", "seconds" and 0, ); if($time>= 31556926){ $value["Years"] = Floor($time/31556926); $time= ($time%31556926); } if($time>= 86400){ $value["Days"] = Floor($time/86400); $time= ($time%86400); } if($time>= 3600){ $value["hours"] = Floor($time/3600); $time= ($time%3600); } if($time>= 60){ $value["minutes"] = Floor($time/60); $time= ($time%60); } $value["seconds"] = Floor($time); //return (array) $value;$t=$value["Years"]. " Years. "$value["Days"]. " Day "." ".$value["Hours"]. " Hours. "$value["Minutes"]. " Points ".$value["Seconds"]. " Seconds; Return$t; }Else{ return(BOOL)FALSE; } }
The above describes the PHP conversion of seconds to time (years, days, hours, minutes, seconds), including the content, I hope to be interested in PHP tutorial friends helpful.