Subtract day with PHP

For Subtract 1 day use this code:

please replace your date with ‘2012-12-12‘.

echo date('Y-m-d', strtotime('-1 day', strtotime('2012-12-12')));

For Subtract 7 days use this code:

please replace your date with ‘2012-12-12‘.

echo date('Y-m-d', strtotime('-7 day', strtotime('2012-12-12')));

For Subtract 30 days use this code:

please replace your date with ‘2012-12-12‘.

echo date('Y-m-d', strtotime('-30 day', strtotime('2012-12-12')));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)