Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php add days to date

<?php  
   
$date = "2022-08-12"; 
  
// Add days to date and display it 
echo date('Y-m-d', strtotime($date. ' +10 days'));  // 2022-08-22
echo date('Y-m-d', strtotime(date('Y-m-d'). ' +1 days')); 	// 2022-08-23
echo date('Y-m-d', strtotime(date('Y-m-d'). ' +1 months')); // 2022-09-12
echo date('Y-m-d', strtotime(date('Y-m-d'). ' +1 year'));	// 2023-08-12
  
?> 
Comment

add 7 days to date php

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

Add 2 days to the current date in PHP

<?php
  $result = date('d.m.Y', strtotime('+2 day', time()));

  echo $result;
?>
Comment

php add days to date

$start_date = "2015/03/02";  
$date = strtotime($start_date);
$date = strtotime("+7 day", $date);
echo date('Y/m/d', $date);
Comment

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

Add 7 days to the current date in PHP

<?php
  $result = date('d.m.Y', strtotime('+7 day', time()));

  echo $result;
?>
Comment

Add 5 days to the current date in PHP

<?php
  $result = date('d.m.Y', strtotime('+5 day', time()));

  echo $result;
?>
Comment

get 2 days before date in php

date('Y/m/d',strtotime("-1 days"));

Or Use DateTime class like this-

$date = new DateTime();
echo $date->modify("-1 days")->format('Y-m-d');
Comment

adding days in datetime php

<?php
$date = new DateTime('2016-06-06'); // Y-m-d
$date->add(new DateInterval('P30D'));
echo $date->format('Y-m-d') . "
";
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php copy file 
Php :: undo php artisan optimize 
Php :: codeigniter 3 limit 
Php :: laravel long description text string 
Php :: laravel add values to request 
Php :: take files from one folder and move to another folder in php 
Php :: seed one table laravel 
Php :: php check if non-object 
Php :: start server in laravel 
Php :: php delete element by value 
Php :: wp wc php if cart page is empty redirect 
Php :: laravel blade if variable exist 
Php :: htaccess set php memory limit 
Php :: laravel collection flatten 
Php :: get author display name wordpress 
Php :: wordpress stop redirect to https 
Php :: test a single file laravel 
Php :: php number precision 
Php :: eloquent cast date 
Php :: how to connect to a database in php 
Php :: php is numeric 
Php :: php check if json 
Php :: laravel get public path url 
Php :: how to start a session 
Php :: php add string inside string at position 
Php :: wordpress on publish hook 
Php :: php include file in parent directory 
Php :: intl extension php ubuntu 
Php :: how to add data to the request object in laravel 
Php :: laravel order by 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =