add day date php code example

Example 1: php date plus days

<?php 
// PHP program to add days to $Date 
  
// Declare a date 
$date = "2019-05-10"; 
  
// Add days to date and display it 
echo date('Y-m-d', strtotime($date. ' + 10 days')); 
  
?>

Example 2: Add days to date in PHP

$date = new DateTime('2020-11-24');
$date->add(new DateInterval("P9D"));

echo $date->format('Y-m-d');

Example 3: add 6 months to date in php

$effectiveDate = date('Y-m-d', strtotime("+3 months", strtotime($effectiveDate)));

Tags:

Php Example