I’m using this code to get number of days in last month, but if the current month is January (01) it’s going to use 00 month instead of 12.
$prev_month_days = cal_days_in_month(CAL_GREGORIAN, date('m')-1, date('Y'));
Searched Google for 20 minutes and could not find any reasonable and shorthand solution.
Please help. Thanks.
Advertisement
Answer
<?php echo date("t", mktime(0,0,0, date("n") - 1)); ?>