码迷,mamicode.com
首页 > Web开发 > 详细

php 日期 - 获取当月最后一天

时间:2015-02-01 20:22:24      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

 1     /**
 2      *    日期-获取当月最后一天
 3      *  @return int
 4      */
 5     public function get_lastday() {
 6         if($this->month==2) {
 7             $lastday = $this->is_leapyear($this->year) ? 29 : 28;
 8         } elseif($this->month==4 || $this->month==6 || $this->month==9 || $this->month==11) {
 9             $lastday = 30;
10         } else {
11             $lastday = 31;
12         }
13         return $lastday;
14     }
15     
16 
17     
18     /**
19      *    日期-是否是闰年
20      *  @return int
21      */
22     public function is_leapyear($year) {
23         return date(‘L‘, $year);
24     }

 

php 日期 - 获取当月最后一天

标签:

原文地址:http://www.cnblogs.com/jackoogle/p/4265938.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!