So if today was April 12, 2010 it should return October 1, 2009
Some possible solutions I\'ve googled seem overly complex, any suggestions?
It was discussed in comments but the accepted answer has some unneeded strtotime()
calls. Can be simplified to:
date("F 1, Y", strtotime("Feb 2, 2010 - 6 months"));
Also, you can use DateTime()
like this which I think is equally as readable:
(new DateTime('Feb 2, 2010'))->modify('-6 months')->format('M 1, Y');
Or using static method....
DateTime::createFromFormat('M j, Y','Feb 2, 2010')
->modify('-6 months')
->format('M 1, Y');