如何将秒转换为年,月和日

时间:2015-02-02 16:31:36

标签: php

我发现这个函数可以将秒转换为日,月,...但是如何计算年数?

function seconds2human($ss) {
   $s = $ss%60;
   $m = floor(($ss%3600)/60);
   $h = floor(($ss%86400)/3600);
   $d = floor(($ss%2592000)/86400);
   $M = floor($ss/2592000);

   return "$M months, $d days, $h hours, $m minutes, $s seconds";
}

0 个答案:

没有答案