<?php $flag_con_time = false; # 用于判断完成时间 (baoming_plus 表) if( !empty($fp_complete_time) ){ # 存在完成时间 $fp_complete_time = $fp_complete_time; }else{ $flag_con_time = true; $fp_complete_time = date("Y-m-d H:i:s"); } # 分单时间 $bmcs_fd_time = $arr_bminfo['Baoming']['bmcs_fd_time']; $seconds = (int)(strtotime($fp_complete_time) - strtotime($bmcs_fd_time)); if( $seconds<86400 ){//如果不到一天 $format_time = gmstrftime('%H 时%M 分%S 秒', $seconds); }else{ $time = explode(' ', gmstrftime('%j %H %M %S', $seconds));//Array ( [0] => 04 [1] => 14 [2] => 14 [3] => 35 ) $format_time = ($time[0]-1).'天'.$time[1].'时'.$time[2].'分'.$time[3].'秒'; } ?>
function timeStamp( second_time ){ var time = parseInt(second_time) + "秒"; if( parseInt(second_time )> 60 ) { var second = parseInt(second_time) % 60; var min = parseInt(second_time / 60); time = min + "分" + second + "秒"; if( min > 60 ) { min = parseInt(second_time / 60) % 60; var hour = parseInt( parseInt(second_time / 60) /60 ); time = hour + "时" + min + "分" + second + "秒"; if( hour > 24 ) { hour = parseInt( parseInt(second_time / 60) /60 ) % 24; var day = parseInt( parseInt( parseInt(second_time / 60) /60 ) / 24 ); time = day + "天" + hour + "时" + min + "分" + second + "秒"; } } } return time; }