DEV Community

David Carr
David Carr

Posted on • Originally published at dcblog.dev on

Get the last day of the month from a date

To get the last day of the month use date('t'):


$dueDate = date('t/m/Y', strtotime($row->created_at));
Enter fullscreen mode Exit fullscreen mode

or with Carbon (Laravel example)


$row->created_at->format('t/m/Y');
Enter fullscreen mode Exit fullscreen mode

Discussion (0)