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.
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.
Your solution is here..
This should work:
Try this , if you are using PHP 5.3+,
For finding next month last date, modify as follows,
and so on..
There is also the built in PHP function cal_days_in_month()?
You can use "
t
" in date function to get the number of day in a particular month.The code will be something like this:
The code is self-explained. So hope it helps.