In this tutorial you will learn how to find PHP date minus one day in a PHP web application .
PHP date minus one day
In this tutorial you will learn how to find PHP date minus one day in a PHP web application . The mktime() function that use for specific date convert to timestamp . The syntax of mktime() as :
mktime(hour,minute,second,month,day,year,is_dst);
When day parameter in mktime() function subtract by one get before one day timestamp .The code of "php-date-minus-one-day.php" given below :
<?php $date=date('Y-m-d'); echo "Date :: ".$date."<br>"; $date_arr=explode('-',$date); echo "Date minus one day =>"; $date2=Date("Y-m-d",mktime(0,0,0,$date_arr[1],$date_arr[2]-1,$date_arr[0])); echo $date2; ?>
Output :
When run "php-date-minus-one-day.php" display output as :
[ 0 ] Comments