Skip to content

All topics  /  PHP

How to Get Previous Year From Date In Php?

PHP ·

Hi Guys,

In this example,I will learn you how to get previous year from date in php.you can easy and simply get previous year from date in php.

we will show you how to get previous year from date in php.if you want to get previous year from date in php then you can use bellow example.

Example:


<?php
    $date = "2020-01-11";
    $newdate = date("Y-m-d",strtotime ( '-1 year' , strtotime ( $date ) )) ;
    echo $newdate;
?>

Output:

2019-01-11

It will help you...