码迷,mamicode.com
首页 > Web开发 > 详细

php面试题

时间:2015-08-26 23:53:13      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

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.

php面试题

标签:

原文地址:http://www.cnblogs.com/xiaoyueer/p/4761920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!