Subtract months from a DateTime object in PHP
Description
The following code shows how to subtract months from a DateTime object.
Example
/* w ww . ja va 2 s. c o m*/
<?php
$date = new DateTime('2001-04-30');
$interval = new DateInterval('P1M');
$date->sub($interval);
echo $date->format('Y-m-d') . "\n";
$date->sub($interval);
echo $date->format('Y-m-d') . "\n";
?>
The code above generates the following result.