PHP date() 函数遇到的坑

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 "
本周开始:" . date('Y-m-d', strtotime('this week')); echo "
本周结束:" . date('Y-m-d', strtotime('last day next week +1 day')); function vdbr($obj) { var_dump($obj); echo '
'; }

你可能感兴趣的:(PHP date() 函数遇到的坑)