我有一种情况,我知道事件的开始日期和持续时间,我如何计算结束日期? 我找到了关于如何计算两个日期之间的持续时间的主题,但在我的案例中没有 提前致谢 。
答案 0 :(得分:2)
日期(strtotime(“+”。durationInDays。“days”)[,startDate])
答案 1 :(得分:0)
使用PHP Date-> modify 方法(也称为 DateTime :: modify )。 因为我也发现PHP网站上的描述不是很明显,我提供了一个示例来展示简单易读的代码:
<?php
$currentDate = new DateTime('2012-12-19');
$currentDate->modify('+2 day');
printf("\nThe maya dooms day is at %s ?!",
date_format( $currentDate, 'D, M d Y'));
?>
在modify参数中,你也可以使用:
还有更多,但你需要更多吗?