【www.bbyears.com--php常用代码】
word-wrap: break-word; margin: 5px 0px; color: rgb(0, 0, 0); font-family: 'sans serif', tahoma, verdana, helvetica; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;">本文实例讲述了php数值转换时间及时间转换数值用法。分享给大家供大家参考,具体如下:
代码如下
echo$startime=strtotime(date("Y-m-d",time()));//当天0点时间戳
echo"
";
echo$endttime=strtotime(date("Y-m-d",time()).' 23:59:59');//当天23:59:59的INT类型时间戳
echo"
";
//把数值型转成时间字符型
$dotime="1357985479";
echodate("Y-m-d H:i:s",$dotime);//把数字型时间按格式转换成时间格
echo"
";
//输出当前时间字符串型
echostrtotime(date('Y-m-d H:i:s',time()));
echo"
";
//把数值型转成字符串型
echodate('Y-m-d H:i:s',�');
echo"
";
//把字符串型转成数值型
echostrtotime('Y-m-d H:i:s');
//echo "
";
//最近七天
echostrtotime("-7 days")
运行结果如下:
代码如下
1495065600
1495151999
2013-01-12 10:11:19
1495073470
2013-01-12 10:11:19
1494468670