转载:php的strtotime举例-lsstarboy-ChinaUnix博客

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 else

    •   PHP官方关于时间描述的文档页,在php手册中还没有相应的内容 :

最新文章

  1. Oracle创建用户设置权限
  2. JavaScript 回忆录
  3. LeetCode OJ 274. H-Index
  4. Codeforces 369E Valera and Queries --树状数组+离线操作
  5. spark1.6配置sparksql 的元数据存储到postgresql中
  6. 加载.properties方式
  7. docker registry 搭建
  8. System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(string, string)已过时的解决办法
  9. TortoiseGit - 处理冲突
  10. JavaScript数组基础及实例
  11. Numpy入门 - 行列式转置
  12. Spring Boot @EnableWebMvc 与 mvc 配置
  13. 关于浏览器对html, js,css的解析先后顺序的理解
  14. linux下安装mysql解决乱码、时间差、表的大小写问题
  15. Derek解读Bytom源码-P2P网络 地址簿
  16. appium API接口
  17. MySql 按周/月/日统计数据的方法
  18. 关于casperjs的wait方法的执行顺序
  19. 1. AutoEncoder介绍
  20. Logback中文文档(四):Appender

热门文章

  1. 在docker中,运行Jcmd命令,报错
  2. Unix时间戳转化成普通日期
  3. PCIe卡设计资料保存:536-基于ZU7EV的FMC 通用PCIe卡
  4. 浏览器 - 重绘(repaint)重排(reflow)
  5. docker tar包下载地址
  6. 搭PHP本地环境-windows
  7. webpack5 与webpack4 之间差别
  8. 谷歌浏览器上elementUI的按钮文字消失了
  9. C# 读取电脑CPU、主板、硬盘序列号等信息
  10. 苹果ios APP怎么打包?推荐这个网站