Home  >  Article  >  Backend Development  >  How to get the start time and end time of a certain month in PHP?

How to get the start time and end time of a certain month in PHP?

WBOY
WBOYOriginal
2016-07-06 13:51:122730browse

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

Reply content:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn