Hari terakhir bulan sebelumnya di PHP
$lastDay = date('t',strtotime('last month'));
print_r($lastDay);
Ankur
$lastDay = date('t',strtotime('last month'));
print_r($lastDay);
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"));
<?php
$date = "2020-01-11";
$newdate = date("Y-m-d", strtotime ( '-1 month' , strtotime ( $date ) )) ;
echo $newdate;
?>