xxxxxxxxxx
$tgl = '25 january 2012';
$prevmonth = date("M Y",mktime(0,0,0,date("m", strtotime($tgl))-1,1,date("Y", strtotime($tgl))));
echo $prevmonth;
xxxxxxxxxx
echo date('M Y', strtotime("-1 month"));
//to get date with time of previous month
echo date("Y-m-d H:i:s",strtotime("-1 month"));
xxxxxxxxxx
<?php
$date = "2020-01-11";
$newdate = date("Y-m-d", strtotime ( '-1 month' , strtotime ( $date ) )) ;
echo $newdate;
?>