public static function convertDate($date) { if (empty($date)) { return ''; } if (ClassicValidator::checkDateRegex($date)) { list($day, $month, $year) = explode(' ', $date); return $year . '-' . self::convertMonth($month) . '-' . $day; } else { throw new \Exception('Invalid date format.'); } }