From 972151d65457524920258f699da3810b711df54a Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Sun, 13 Mar 2005 10:20:44 +0000 Subject: [PATCH] Bug 1641: ISO 8601 support for some date functions --- languages/Language.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/languages/Language.php b/languages/Language.php index 2a5262fd26..3d49e7c6eb 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1970,30 +1970,34 @@ class Language { switch( $datePreference ) { case 1: return "$month $day, $year"; case 2: return "$day $month $year"; + case 4: return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2); default: return "$year $month $day"; } } function time( $ts, $adj = false, $seconds = false, $timecorrection = false ) { + global $wgUser; $ts=wfTimestamp(TS_MW,$ts); if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ); - if ( $seconds ) { + if ( $seconds || $wgUser->getOption( 'date' ) == 4) { $t .= ':' . substr( $ts, 12, 2 ); } return $this->formatNum( $t ); } function timeanddate( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false, $dateandtime = false) { + global $wgUser; $ts=wfTimestamp(TS_MW,$ts); - if ($dateandtime) { - $ret = $this->date( $ts, $adj, $format, $timecorrection ) . ', ' . $this->time( $ts, $adj, false, $timecorrection ); + if ( 4 == $wgUser->getOption( 'date' ) ) { + return $this->date( $ts, $adj, $format, $timecorrection ) . ' ' . + $this->time( $ts, $adj, false, $timecorrection ); } else { - $ret = $this->time( $ts, $adj, false, $timecorrection ) . ', ' . $this->date( $ts, $adj, $format, $timecorrection ); + return $this->time( $ts, $adj, false, $timecorrection ) . ', ' . + $this->date( $ts, $adj, $format, $timecorrection ); } - return $ret; } function rfc1123( $ts ) { -- 2.20.1