Answers for "php add 14 days to date"

PHP
0

add 7 days to date php

$date = "Mar 03, 2011";
$date = strtotime($date);
$date = strtotime("+7 day", $date);
echo date('M d, Y', $date);
Posted by: Guest on April-20-2020
0

how to add extra days from a date php

<?php
  // adding extra days to date 
  
  // Steps:
	// 1) using carbon
    // 2) using strtotime
      
    //Step 1
  $date = date('Y M d h:i:s') // 2020 09 22 22:09:26 UTC
  
  $new_date = Carbon::parse($date->addDays(1); // adds extra day
                            
  // Step 2
  $date = date('Y M d h:i:s') // 2020 09 22 22:09:26 UTC
  
  echo $new_date = date('Y M d h:i:s', strtotime($date. '+1 day'));
?>
Posted by: Guest on September-22-2020
2

Add days to date in PHP

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

echo $date->format('Y-m-d');
Posted by: Guest on January-14-2021

Browse Popular Code Answers by Language