Skip to main content

Useful PHP Codes

Increment a Date by Month, Day or Year

Increment by month

    1. $time = strtotime("2014-12-11");
      $d = date("Y-m-d", strtotime("+1 month", $time));

Increment by day

  1. $time = strtotime("2014-12-11");
    $d = date("Y-m-d", strtotime("+1 day", $time));

Increment by year

  1. $time = strtotime("2014-12-11");
    $d = date("Y-m-d", strtotime("+1 year", $time));