예제 #1
0
 /**
  * Get the previous year if the month is january
  * 
  * @param mixed $date The date or a time
  * @return integer the previous year or the current year
  */
 public static function getYearPrevMonth($date)
 {
     $currentMonth = date('n', Datepicker::getTime($date));
     if ($currentMonth == 1) {
         $lastYear = date('Y', Datepicker::getTime($date)) - 1;
     } else {
         $lastYear = date('Y', Datepicker::getTime($date));
     }
     return $lastYear;
 }