php strtotime,php的strtotime举例

1、上周日午夜

strtotime("last sunday");

2、本周日午夜

strtotime("this sunday");

3、今天午夜

strtotime("today");

4、昨天午夜

strtotime("yesterday");

5、上周同一时间

strtotime("-1 week");

6、上月第一天午夜:

strtotime("first day of last month midnight");

注意:不带midnight的话,就是上月第一天这个时候的秒数!

7、本月第一天午夜

strtotime("first day of this month midnight");

8、本年第一天午夜

strtotime("first day of jan");

注意,下面的结果是错误的,是本月的第一天:

strtotime("first day of year midnight");

9、指定日期:

strtotime("2011-01-01 midnight");

10、strtotime("first day of last year midnighth");会出现什么?

切记:会出现上年上个月份最后一天!

实际的测试:好像last和first都不能针对年,只对月有效文档中的说明也有错误:

strtotime('last day of this year') doesn't work because last day of is only for month

use strtotime('-1 day', strtotime('first day of next year')) or anything elsePHP官方关于时间描述的文档页,在php手册中还没有相应的内容 :

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值