Sometimes, we want to find the last day of the month from date with PHP.
In this article, we’ll look at how to find the last day of the month from date with PHP.
How to find the last day of the month from date with PHP?
To find the last day of the month from date with PHP, we can use the date
function.
For instance, we write
$a_date = "2020-11-23";
echo date("Y-m-t", strtotime($a_date));
to call date
with "Y-m-t"
and strtotime($a_date)
to return the last day of the month of the $a_date
date.
Conclusion
To find the last day of the month from date with PHP, we can use the date
function.