/** * Format a time according to the current locale * * @param $sql_date An SQL formatted date * @param $locale string The locale to use. If no locale is given, the current locale is used * @return string A time formatted according to the given locale */ public static function sql_to_time($sql_date, $locale = null) { $sql_date = trim($sql_date); if (strlen($sql_date) == 0 || $sql_date == '0000-00-00' || $sql_date == '0000-00-00 00:00:00') { return null; } $format = DateTool::get_time_format($locale); return date($format, strtotime($sql_date)); }