Home > Article > Backend Development > How to get the start time and end time of a certain month in PHP?
For example, July, some months have 28 days, some have 29 days, some have 30 days, some have 31 days. Is there any related class library that can return the end time of a month based on the month, such as the end of July? The time is 2016-07-31
For example, July, some months have 28 days, some have 29 days, some have 30 days, some have 31 days. Is there any related class library that can return the end time of a month based on the month, such as the end of July? The time is 2016-07-31
Every month starts with 01, so you don’t have to look at it
Use it on the last day of each month
<code>date("t");//给定月份所应有的天数 </code>
<code>date("Y-m-d", strtotime("last day of july"))</code>
You can go to Google
and download the strtotime
function, there are many interesting uses!