In this tutorial you will learn how to find PHP date of last year in a PHP web application .
PHP date last year
In this tutorial you will learn how to find PHP date of last year in a PHP web application . The $current_date variable that store current date and strtotime() that return date to Unix timestamp. When pass parameter ( "-1 year",$strtotime ) in strtotime() function it return one year before timestamp that also date of last year . The code of "php-date-last-year.php" given below :
<?php
$current_date=date("Y-m-d");
echo "Current Date : ".$current_date;
echo "<br>";
$strtotime=strtotime($current_date);
$last_year=strtotime("-1 year",$strtotime);
echo "Date last year : ";
echo date("Y-m-d",$last_year);
?>
Output :
When run "php-date-last-year.php" display output as :


[ 0 ] Comments