php面试题

1.用PHP打印出前一天的时间格式是2006-5-10 22:21:21(2分)

<?php
date_default_timezone_set('Asia/shanghai'); 
echo date_default_timezone_get();
echo "<br/>"; 
echo @date("Y-m-d H:i:s",strtotime("-1 day"));
echo(strtotime("now")); //当前时间戳
echo(strtotime("+5 hours",strtotime("1970-01-01"))); //距离1970-01-01后5个小时的时间戳 echo(strtotime("3 October 2005"));//2005年10月3日时间戳 echo(strtotime("+5 hours")); //当前时间加5个小时的时间戳 echo(strtotime("+1 week")); //当前时间加一周的时间戳 echo(strtotime("+1 week 3 days 7 hours 5 seconds")); //当前时间加一周3天7小时5秒钟的时间戳 echo(strtotime("next Monday")); //当前时间到下个周一0点的时间戳 echo(strtotime("last Sunday")); //上个周日凌晨到当前时间的时间戳 ?>

2.

posted @ 2015-08-26 22:50  笑月儿  Views(196)  Comments(0Edit  收藏  举报