Get the last day of the month from a date

David Carr

Laravel Framework Tutorials PHP & MySQL

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

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

or with Carbon (Laravel example)

$row->created_at->format('t/m/Y');

 

Read articles directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Copyright © 2006 - 2024 DC Blog - All rights reserved.