PHP时间处理

PHP求某一天,上周,上月等等的方式

  1. 上一周的时间:
    date('Y-m-d',strtotime('-1 week'));

     

  2. 上周五(上周几):
    dete('Y-m-d',strtotime('-1 Friday'));

     

  3. 某一天的前一天:
    date('Y-m-d',strtotime('-1 day 2014-9-10 12:12:12'));

     

  4. 某一天的前一月:
    date('Y-m-d',strtotime('-1 month 2014-9-10 12:12:12'));

     

  5. 上月第一天和上月最后一天:
    date('Y-m-01', strtotime('-1 month'));
    date('Y-m-t', strtotime('-1 month'));

     

  6. 本月的第一天和最后一天:
    date('Y-m-01',time());
    date('Y-m-t',time());

     

posted @ 2015-04-02 13:46  520php  阅读(106)  评论(0编辑  收藏  举报