Answers for "how to find previous date in php"

PHP
1

tomorrow date php

$tomorrow = date("Y-m-d", strtotime('tomorrow'));
or 
$tomorrow = date("Y-m-d", strtotime("+1 day"));

for DateTime
  
$datetime = new DateTime('tomorrow');
echo $datetime->format('Y-m-d H:i:s');

or

$datetime = new DateTime('2013-01-22');
$datetime->modify('+1 day');
echo $datetime->format('Y-m-d H:i:s');
Posted by: Guest on June-26-2020
1

tomorro date php

$tomorrow = date("Y-m-d", strtotime('tomorrow'));
or 
$tomorrow = date("Y-m-d", strtotime("+1 day"));

for DateTime
  
$datetime = new DateTime('tomorrow');
echo $datetime->format('Y-m-d H:i:s');

or

$datetime = new DateTime('2013-01-22');
$datetime->modify('+1 day');
echo $datetime->format('Y-m-d H:i:s');
Posted by: Guest on June-10-2020
0

php date function get previous month

$tgl = '25 january 2012';

$prevmonth = date("M Y",mktime(0,0,0,date("m", strtotime($tgl))-1,1,date("Y", strtotime($tgl))));
echo $prevmonth;
Posted by: Guest on August-18-2020

Code answers related to "how to find previous date in php"

Browse Popular Code Answers by Language