Reputation: 6615
Is there a way that I can have mktime go back a certain amount of months based of the first day of the month rather than the current day? Right now my code is echoing March instead of February because there is no 29 in February.
date("F Y", mktime(0, 0, 0, date('m') - 8, date('d'), date('Y')))
Upvotes: 1
Views: 235
Reputation: 54619
Just set the "day" parameter to 1:
date("F Y", mktime(0, 0, 0, date('m') - 8, 1, date('Y')))
Upvotes: 3