php date + days 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 7 days to date php

$date = "Mar 03, 2011";
$date = strtotime($date);
$date = strtotime("+7 day", $date);
echo date('M d, Y', $date);

Example 3: php days in month

// For given month
echo cal_days_in_month(CAL_GREGORIAN, 1, 2021);
// For current month
echo date('t');

Tags:

Php Example