php 中的date和strtotime函数
来源:互联网 发布:华为怎么清除缓存数据 编辑:程序博客网 时间:2024/04/27 16:24
all from : http://www.php.net/manual/zh/function.strtotime.php
strtotime — 将任何英文文本的日期时间描述解析为 Unix 时间戳
date_default_timezone_set('Asia/Shanghai');
计算昨天的时间,我们用:
date("Ymd",time()-3600);
可以的
另外我们还可以用strtotime()来简单的生成时间,例如:
//生成昨天的时间
date("Ymd",strtotime('yesterday'));
date("Ymd",strtotime('-1 day'));
//生成前天的时间
date("Ymd",strtotime('yesterday -1 day'));
date("Ymd",strtotime('-2 day'));
//生成3天之后的时间
date("Ymd",strtotime('+3 day'));
//生成一个月前的时间
date("Ymd",strtotime('-1 month'));
甚至还可以这么用:
//生成下个月最后一天的时间 - -! 看到这个,你明白了其实你可以用自然语言直接描述~~~php的strtotime()来任意取得自然时间~~太强大了~~
date("Ymd",strtotime('last day of next month'));
//下个周的星期一
date("Ymd",strtotime('next monday'));
strtotime()函数很好用,可以多看看相关技巧~~
0 0
- php 中的date和strtotime函数
- php strtotime函数和date函数用法
- PHP 时间的获取和使用 date()和strtotime()函数
- php中date函数和strtotime的使用
- PHP date strtotime
- php中date()、mktime()、strtotime()三个函数使用
- PHP函数strtotime详解
- PHP函数strtotime详解
- php函数 strtotime
- PHP strtotime函数详解
- PHP strtotime() 函数
- PHP strtotime函数详解
- PHP strtotime()函数
- PHP strtotime() 函数
- PHP strtotime() 函数
- php日期时间处理date() strtotime() mktime()
- php 使用date及strtotime等日期时间函数的注意
- [转]PHP函数strtotime详解
- 富士康高管三年受贿逾千万 回扣牵出管理难题
- htm按扭激活.net按扭过程
- poj1328--Radar Installation
- 微信公众帐号开发教程第4篇-消息及消息处理工具的封装
- 2499元索尼T2领跑 主打差异化手机推荐
- php 中的date和strtotime函数
- UML中的六大关系
- MFC学习之第四天 (一)
- JAVA card 应用开发(二) 在项目增加APPLET
- easyui结合struts
- 备份Toad中保存的数据库连接用户名和密码
- 【佛山】地铁2号线“海口站”改“张槎站”设7换乘站
- uboot中make menuconfig以及添加命令
- 微信公众帐号开发教程第5篇-各种消息的接收与响应