日期:2014-05-17 浏览次数:20377 次
<?php function format_time($time){ $t=time()-$time; $f=array( '31536000'=>'年', '2592000'=>'个月', '604800'=>'星期', '86400'=>'天', '3600'=>'小时', '60'=>'分钟', '1'=>'秒' ); foreach ($f as $k=>$v) { if (0 != $c=floor($t/(int)$k)) { return $c.$v.'前'; } } } echo format_time('1336880454'); ?>
<?php $time1 = "2012-05-13 11:40:54"; $time2 = strtotime($time1); echo $time2;//转换成时间戳格式 echo date('',$time2);//转换成标准日期格式 ?>
<?php while ($row = mysql_fetch_array($rs_tmmsm)) {?> <?=date("Y-m-d <!--h:i-->",strtotime($row["pay_time"]))?> <?php }?>
<?php function format_time($time){ $t=time()-$time; $f=array( '31536000'=>'年', '2592000'=>'个月', '604800'=>'星期', '86400'=>'天', '3600'=>'小时', '60'=>'分钟', '1'=>'秒' ); foreach ($f as $k=>$v) { if (0 != $c=floor($t/(int)$k)) { return $c.$v.'前'; } } } while ($row = mysql_fetch_array($rs_tmmsm)) { echo format_time(strtotime($row["pay_time"])); } ?>