How to find the last day of the month from date?
How can I get the last day of the month in PHP?
Given:
$a_date = "2009-11-23"
I want 2009-11-30; and given
$a_date = "2009-12-23"
I want 2009-12-31.
Jeffrey P.
answered 07/19/23
You need help with PHP? Send me a message.
<?php
$a_date = "2009-11-23";
$lastDayOfMonth = date("Y-m-t", strtotime($a_date));
echo $lastDayOfMonth;
?>
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.