From d5a39e640b4e075d316a23b74d57d2db2d2ab690 Mon Sep 17 00:00:00 2001 From: alec Date: Thu, 17 Apr 2008 20:05:58 +0000 Subject: - Fix non-RFC dates formatting (#1484901) git-svn-id: https://svn.roundcube.net/trunk@1324 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/include/main.inc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'roundcubemail/program/include') diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 09a53f0ad..b5004e899 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/program/include/main.inc @@ -1507,12 +1507,22 @@ function format_date($date, $format=NULL) global $CONFIG, $sess_user_lang; $ts = NULL; - + if (is_numeric($date)) $ts = $date; else if (!empty($date)) - $ts = @strtotime($date); - + { + while (($ts = @strtotime($date))===false) + { + // if we have a date in non-rfc format + // remove token from the end and try again + $d = explode(' ', $date); + array_pop($d); + if (!$d) break; + $date = implode(' ', $d); + } + } + if (empty($ts)) return ''; -- cgit v1.2.3