示例#1
0
文件: DateLocal.php 项目: arbi/MyCode
 public static function convertDateFromYMD($date, $secondaryDate = null)
 {
     if (empty($date)) {
         return '';
     }
     if (ClassicValidator::checkDateRegexYMD($date)) {
         list($year, $month, $day) = explode('-', $date);
         try {
             $rightDate = self::convertMonth($month) . ' ' . $day . ', ' . $year;
         } catch (\Exception $ex) {
             $rightDate = $secondaryDate;
         }
         return $rightDate;
     } else {
         throw new \Exception('Invalid date format.');
     }
 }