Heim >Backend-Entwicklung >PHP-Tutorial >php获取每月第一天与最后一天实例

php获取每月第一天与最后一天实例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 09:13:151020Durchsuche

例子,php获取每月第一天与最后一天。 php日期函数 date用法。

  1. function getthemonth($date)
  2. {
  3. $firstday = date('y-m-01', strtotime($date));
  4. $lastday = date('y-m-d', strtotime("$firstday +1 month -1 day"));
  5. return array($firstday,$lastday);
  6. }
  7. $today = date("y-m-d");
  8. $day=getthemonth($today);
  9. ?>
复制代码


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