Heim >Backend-Entwicklung >PHP-Tutorial >PHP如何获取某个月的开始时间和结束时间?

PHP如何获取某个月的开始时间和结束时间?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-06 13:51:122786Durchsuche

比如 7月,有的月份是28天,有的29天,有的30,有的31天,有没有相关的类库能根据月份返回一个的月的结束时间,比如 7月的结束时间为2016-07-31

回复内容:

比如 7月,有的月份是28天,有的29天,有的30,有的31天,有没有相关的类库能根据月份返回一个的月的结束时间,比如 7月的结束时间为2016-07-31

每月开始都是01,所以不用看
每月的最后一天使用

<code>date("t");//给定月份所应有的天数
</code>

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

可以去 Googlestrtotime 函数,有很多很吊的用法!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn