How to Get Previous Month From Date In Php?

03-Apr-2023

.

Admin

Hi Guys,

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

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

Example:


<?php

$date = "2020-01-11";

$newdate = date("Y-m-d", strtotime ( '-1 month' , strtotime ( $date ) )) ;

echo $newdate;

?>

Output:

2019-12-11

It will help you...

#PHP