how do i display a date by adding a few months to it

左心房为你撑大大i 提交于 2019-12-25 01:53:33

问题


if i have a date 10/10/2009 and i wanted to add strtotime(+# months) to display an expiration date?

the 10/10/2009 is a start date which is imputed by the customer and the +# months is how ever many months were added for a specific product to display the expiration date.

how would i add the two to find the expiration date?


回答1:


This tutorial helped me with exactly this kind of problem recently.

$date = "2009-10-10";
$newdate = strtotime ("$date +3 month") ;
$newdate = date ( 'Y-m-j' , $newdate );

echo $newdate;


来源:https://stackoverflow.com/questions/3722442/how-do-i-display-a-date-by-adding-a-few-months-to-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!