/ Published in: PHP

This snippet will format time() into something a bit more user friendly. Title explains it better.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function _ago($tm,$rcs = 0) { for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm); return $x; }
Comments
