加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

与strtotime PHP的错误

发布时间:2020-12-13 22:42:48 所属栏目:PHP教程 来源:网络整理
导读:echo date("m",strtotime("january")); 按预期返回01 echo date("m",strtotime("february")); 但这会返回03 其他人遇到过这个问题? PHP版本5.1.6 今天是29日.今年2月没有29日,因为你没有在2月份指定一天,所以它正在使用“今天”. strtotime 功能使用相对日
echo date("m",strtotime("january"));

按预期返回01

echo date("m",strtotime("february"));

但这会返回03

其他人遇到过这个问题?

PHP版本5.1.6

今天是29日.今年2月没有29日,因为你没有在2月份指定一天,所以它正在使用“今天”. strtotime功能使用相对日期,因此2月29日基本上是今年3月1日.

要解决您的问题:

echo date("m",strtotime("February 1"));

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读