Reputation: 1
I want to subtract one date in 2016 from current date using php and display day.How i do this using php . can anyone help me . please give suggestion
Any ideas how I can accomplish this?
Upvotes: 0
Views: 46
Reputation: 470
check this code snippet
<?php
$date = new DateTime();
$date->modify('-1 day');
echo $date->format('Y-m-d');
?>
Based on the number of day you need to put the parameter $date->modify('-{NoofdaystoSubstract} day');
Upvotes: 1