美文网首页
PHP date() 函数遇到的坑

PHP date() 函数遇到的坑

作者: 鱼落于天 | 来源:发表于2018-09-10 16:35 被阅读0次
    vdbr(date("Y-m-d", strtotime("2017-06-31")));
    //输出2017-07-01
    vdbr(date("Y-m-d", strtotime("-1 month", strtotime("2017-03-31"))));
    //输出2017-03-03
    vdbr(date("Y-m-d", strtotime("+1 month", strtotime("2017-08-31"))));
    //输出2017-10-01
    vdbr(date("Y-m-d", strtotime("next month", strtotime("2017-01-31"))));
    //输出2017-03-03
    vdbr(date("Y-m-d", strtotime("last month", strtotime("2017-03-31"))));
    //输出2017-03-03
    
    vdbr(date("Y-m-d", strtotime("last day of -1 month", strtotime("2017-03-31"))));
    //输出2017-02-28
    vdbr(date("Y-m-d", strtotime("first day of +1 month", strtotime("2017-08-31"))));
    ////输出2017-09-01
    vdbr(date("Y-m-d", strtotime("first day of next month", strtotime("2017-01-31"))));
    ////输出2017-02-01
    vdbr(date("Y-m-d", strtotime("last day of last month", strtotime("2017-03-31"))));
    ////输出2017-02-28
     echo "<br>本周开始:" . date('Y-m-d', strtotime('this week'));
    echo "<br>本周结束:" . date('Y-m-d', strtotime('last day next week +1 day'));
    function vdbr($obj) {
        var_dump($obj);
        echo '<br/>';
    }
    

    相关文章

      网友评论

          本文标题:PHP date() 函数遇到的坑

          本文链接:https://www.haomeiwen.com/subject/bsgsgftx.html