注册 登录
编程论坛 PHP技术论坛

php 有关时间的函数的用法

zhimengren 发布于 2012-11-07 16:18, 689 次点击
用PHP打印出前一天的时间格式echo date('Y-m-d H:i:s', strtotime('-1 day'));
在做网站项目时(http://),用的比较多时间关联,现在整理一些出来大家分享:
strtotime -- 将任何英文文本的日期时间描述解析为 Unix 时间戳
例子 1. strtotime() 例子
<?php
echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
?>
3 回复
#2
bjshunshun2012-12-06 09:35
学习中 好好了解
#3
gaoce2272012-12-10 23:54
手册上就有呀
1