• 时间函数strtotime的强大


    转载: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手册中还没有相应的内容 :
  • 相关阅读:
    怎么在excel单元格里原有的筛选里面添加新选项
    redis通信协议
    nginx路由文件配置
    R语言绘制相对性关系图
    Generator函数的语法
    360前端星计划作业
    工厂模式
    ReferenceError与undefined的区别
    for...in与点语法
    博客申请成功
  • 原文地址:https://www.cnblogs.com/fengqyuan/p/14985372.html
Copyright © 2020-2023  润新知