datetime previous day php code example Example: last day of previous month in php $lastDay = date('t',strtotime('last month')); print_r($lastDay);