strtotime 的 BUG

strtotime('+1 month'),strtotime('-1 month')  碰到一个月中有28, 31天的就会有问题, 比如 strtotime('+1 month', strtotime('2019-10-31')) 就会跳到 12月份去,而不是11月份;

所以一般要用 

strtotime('last day of +1month')

 

或者

strtotime('first day of +1 month')

 

posted @ 2019-11-16 11:00  一粒小米-博客  阅读(318)  评论(0编辑  收藏  举报