php怎么增加日期,php – 增加日期日期的问题

我试着在m-d-Y中增加天数(60)但计算错误的一天.它被认为是d-m-y格式.

echo "Today is :: ".date("m-d-Y");

echo "\n";

echo $DateEnd = date('m-d-Y', strtotime(date("m-d-Y") . ' +60 day'));

输出是::

Today is :: 11-07-2017

End date is :: 09-09-2017

任何帮助或建议将不胜感激

解决方法:

问题原因: – strtotime()注意事项: –

Dates in the m/d/y or d-m-y formats are disambiguated by looking

at the separator between the various components: if the separator is a

slash (/), then the American m/d/y is assumed; whereas if the

separator is a dash (-) or a dot (.), then the European d-m-y format

is assumed. If, however, the year is given in a two digit format and

the separator is a dash (-, the date string is parsed as y-m-d.

Som-d-Y是无法识别的格式,同时为php日期添加天数.

如下所示: –

echo "Today is :: ".date("m-d-Y");

echo "\n";

echo $DateEnd = date('m-d-Y', strtotime(date("y-m-d") . '+60 days'));

标签:php,date,strtotime,days

来源: https://codeday.me/bug/20190722/1500814.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值