Php second format: day hour minute second php code:
/*** PHP formatting seconds */function vtime ($ time) {$ output = ''; foreach (array (86400 => 'day', 3600 => 'URL ', 60 => 'Minute ', 1 => 'second') as $ key => $ value) {if ($ time >=$ key) $ output. = floor ($ time/$ key ). $ value; $ time % = $ key;} return $ output ;}
Dida_bootstrap.inc
/*** Calculate the length of the specified number of seconds from the current time * @ param int $ timestamp * in seconds, usually the current time minus another time * @ param int $ granularity * Display level, the default value is year, week, day, hour, minute, second * @ return string */function format_interval ($ timestamp, $ granularity = 5) {$ units = array (31536000 => t ('system ', 'year'), 604800 => t ('system', 'week'), 86400 => t ('system', 'day '), 3600 => t ('system', 'URL'), 60 => t ('system', 'min'), 1 => t ('system ', 'second'); $ output = ''; foreach ($ units As $ key =>$ value) {if ($ timestamp >=$ key) {$ output. = floor ($ timestamp/$ key ). $ value; $ timestamp % = $ key; $ granularity --;} if ($ granularity = 0) {break ;}} return $ output? $ Output: t ('system', '0 second ');}