summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-04-17 20:05:58 +0000
committeralecpl <alec@alec.pl>2008-04-17 20:05:58 +0000
commitea090ca09d2ee04c68c524f0e3c63de2fdb21a04 (patch)
tree4c52aea90a9e7ab2ae99c9c69cecb9daeab0ae7a /program/include
parentf294da0d9e2088fe663228f796cd8d2df2c03972 (diff)
- Fix non-RFC dates formatting (#1484901)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/main.inc16
1 files changed, 13 insertions, 3 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 09a53f0ad..b5004e899 100644
--- a/program/include/main.inc
+++ b/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 '';