0

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?

  • 2
    Possible duplicate of [Subtracting two dates in php](http://stackoverflow.com/questions/10469037/subtracting-two-dates-in-php) – default locale Feb 01 '17 at 06:56

1 Answers1

1

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');

ben
  • 470
  • 3
  • 11