PHP通过向变量日期添加天数来计算未来日期 [英] PHP Calculating future date by adding days to a variable date
本文介绍了PHP通过向变量日期添加天数来计算未来日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在看这篇文章,它接近于我所需要的:
如何从添加日期计数60天
但是,在该帖子中,计算是通过在当前日期添加60天来执行。我需要做的是根据可变日期(而不是当前日期)计算日期。
这样的事情: p>
$ my_date = $ some_row_from_a_database;
$ date_plus_10_days = ???
任何人都知道该怎么做?
解决方案
你可以在+10天部分之前放一些东西:
strtotime(2010-01-01 +10天);
I was looking at this post, and it is close to what I need: PHP - How to count 60 days from the add date
However, in that post, the calculation is performed by adding 60 days to the current date. What I need to do is calculate the date based on a variable date (and not the current date).
Something like this:
$my_date = $some_row_from_a_database;
$date_plus_10_days = ???;
Anyone know how to do that?
Thanks
解决方案
You can put something before the "+10 days" part:
strtotime("2010-01-01 +10 days");
这篇关于PHP通过向变量日期添加天数来计算未来日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文