I\'m trying to create a simple function which returns me a date with a certain number of subtracted days from now, so something like this but I dont know the date classes we
Try to use datetime::sub
Example from the docs (linked):
format("d-m-Y H:i:s").'
';
date_sub($date, new DateInterval("P5D"));
echo '
'.$date->format("d-m-Y").' : 5 Days';
date_sub($date, new DateInterval("P5Y5M5D"));
echo '
'.$date->format("d-m-Y").' : 5 Days, 5 Months, 5 Years';
date_sub($date, new DateInterval("P5YT5H"));
echo '
'.$date->format("d-m-Y H:i:s").' : 5 Years, 5 Hours';
?>