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

WBOY
Release: 2016-07-06 13:51:12
Original
2722 people have browsed it

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>
Copy after login

<code>date("Y-m-d", strtotime("last day of july"))</code>
Copy after login

You can go to Google and download the strtotime function, there are many interesting uses!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!