Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Add 2 days to the current date in PHP

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

  echo $result;
?>
Comment

Get the number of days between two dates in PHP

$startDate = new DateTime("2019-10-27");
$endDate = new DateTime("2020-04-11");

$difference = $endDate->diff($startDate);
echo $difference->format("%a");
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

get number of days between two dates php

//get Date diff as intervals 
$d1 = new DateTime("2018-01-10 00:00:00");
$d2 = new DateTime("2019-05-18 01:23:45");
$interval = $d1->diff($d2);
$diffInSeconds = $interval->s; //45
$diffInMinutes = $interval->i; //23
$diffInHours   = $interval->h; //8
$diffInDays    = $interval->d; //21
$diffInMonths  = $interval->m; //4
$diffInYears   = $interval->y; //1
Comment

get number of days between two dates php

$now = time(); // or your date as well
$your_date = strtotime("2010-01-31");
$datediff = $now - $your_date;

echo round($datediff / (60 * 60 * 24));
Comment

php get all days between two dates

$period = new DatePeriod(
     new DateTime('2010-10-01'),
     new DateInterval('P1D'),
     new DateTime('2010-10-05')
);

foreach ($period as $key => $value) {
    //$value->format('Y-m-d')       
}
Comment

PREVIOUS NEXT
Code Example
Php :: query php 
Php :: laravel password encryption 
Php :: php erase element from array 
Php :: default value date symfony entity 
Php :: send multiple mail in laravel 
Php :: ubuntu install php 7 
Php :: show float laravel blade 
Php :: default timezone php 
Php :: php replace first occurrence in string 
Php :: exec output php 
Php :: redrectnh to https n laravel 
Php :: get id by url wordpress 
Php :: php binary to base64 
Php :: php array sort by key value 
Php :: upload a pdf file laravel 
Php :: laravel folder permission 
Php :: convert text file to json php 
Php :: check if date between two dates laravel 
Php :: check if the request is ajax request in laravel 
Php :: php ternary operators 
Php :: wp get post id by slug 
Php :: laravel auth without vue or bootstrap 
Php :: php array_map() 
Php :: 0 
Php :: php pdo postegresql connection 
Php :: php time() function 
Php :: php time to date 
Php :: clone array php 
Php :: laravel new line in language file 
Php :: laravel wherenotin 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =