I've got a date in this format:
2009-01-01
How do I return the same date but 1 year earlier?
You can use strtotime:
strtotime
$date = strtotime('2010-01-01 -1 year');
The strtotime function returns a unix timestamp, to get a formatted string you can use date:
date
echo date('Y-m-d', $date); // echoes '2009-01-01'
1.4m articles
1.4m replys
5 comments
57.0k users