function getLastDayOfMonth($year,$month) { $lastdayOfMonth = date('Y-m-d',strtotime('-1 second',strtotime('+1 month',strtotime($month.'/01/'.$year.' 00:00:00')))); return $lastdayOfMonth; }
This function gets current month and year as the input returns the last day of the month.
It add one month to the current month and reduce one second from the 00:00:00 th hour of the first day so to get the last day of this month.
No comments:
Post a Comment