PHP获取当前日期或指定日期的所在月的第一天和最后一天

<?php
  function getthemonth($date)
    {
      $firstday = date('Y-m-01', strtotime($date));
      $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
      return array($firstday,$lastday);
    }
  $today = date("Y-m-d");
  $day=getthemonth($today);
?>

 

posted @ 2013-08-28 13:54  输不起de青春  阅读(453)  评论(0)    收藏  举报