码迷,mamicode.com
首页 > 其他好文 > 详细

strtotime 的 BUG

时间:2019-11-16 12:16:34      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:nbsp   style   day   一个   fir   bsp   code   first   12月   

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‘)

 

strtotime 的 BUG

标签:nbsp   style   day   一个   fir   bsp   code   first   12月   

原文地址:https://www.cnblogs.com/pyspang/p/11871012.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!