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

2019-08-23 11:16发布

问题:

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;


标签: php strtotime