예제 #1
0
파일: DateLocal.php 프로젝트: arbi/MyCode
 public static function convertMonth($month)
 {
     $months = Objects::getMonths();
     if (in_array($month, $months)) {
         array_unshift($months, '');
         $monthsReversed = array_flip($months);
         return str_pad($monthsReversed[$month], 2, '0', STR_PAD_LEFT);
     } elseif (in_array($month, range(1, 12))) {
         array_unshift($months, '');
         return $months[(int) $month];
     } else {
         throw new \Exception('Wrong month name.');
     }
 }