添加日期到PHP日期 [英] Add days to a date in PHP

查看:84
本文介绍了添加日期到PHP日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可用的php功能,我可以添加日期到日期以补充另一个日期?例如,我有以下格式的日期:
2011年12月27日

Is there any php function available where I can add days to a date to make up another date? For example, I have a date in the following format: 27-December-2011

如果我添加7到上面,它应该给:
03-January-2012。

If I add 7 to the above, it should give: 03-January-2012.

非常感谢

推荐答案

尝试这个

$add_days = 7;
$date = date('Y-m-d',strtotime($date) + (24*3600*$add_days));

这篇关于添加日期到PHP日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆