Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4177217
  • 博文数量: 601
  • 博客积分: 15410
  • 博客等级: 上将
  • 技术积分: 6884
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-16 08:11
个人简介

独学而无友,则孤陋而寡闻!

文章分类

全部博文(601)

文章存档

2020年(1)

2018年(4)

2017年(7)

2016年(42)

2015年(25)

2014年(15)

2013年(36)

2012年(46)

2011年(117)

2010年(148)

2009年(82)

2008年(37)

2007年(41)

分类: Python/Ruby

2011-03-18 10:02:47

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手册中还没有相应的内容 :

   

阅读(7346) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~