Answers for "time 2 days back php"

PHP
1

php 3 days after

$Today=date('y:m:d');
  
// Declare a date 
$date = "2019-05-10"; 
  
//if already have time  then use this  =============
echo date('Y-m-d', strtotime($Today. ' + 10 days')); 

//if already have time  then use this  =============

// add 3 days to date
$NewDate=Date('y:m:d', strtotime('+3 days'));

// subtract 3 days from date
$NewDate=Date('y:m:d', strtotime('-3 days'));

// PHP returns last sunday's date
$NewDate=Date('y:m:d', strtotime('Last Sunday'));

// One week from last sunday
$NewDate=Date('y:m:d', strtotime('+7 days Last Sunday'));
Posted by: Guest on March-22-2022
-1

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');
Posted by: Guest on June-22-2021

Browse Popular Code Answers by Language