PHP date get yesterday

PHP date get yesterday


Posted in : PHP Posted on : January 25, 2011 at 6:40 PM Comments : [ 0 ]

In this tutorial you will learn how to find PHP date of yesterday in a PHP web application.

PHP date get yesterday

In this tutorial you will learn how to find PHP date of yesterday in a PHP web application. The date() return current date and strtotime() that return date in Unix timestamp (in second )  and if pass parameter "-1 day" , return one day before. The code of "php-date-get-yesterday.php" given below :

<?php
$date=date('Y-m-d');
echo "Current date : ".$date."<br>";
echo "yesterday : ".date("Y-m-d", strtotime("-1 day")); 
?>

Output :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics