From 66d8c6a289aa1272dbe553de97795baa3d83049c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 4 Apr 2005 22:58:18 +0000 Subject: [PATCH] * Documented --- languages/Language.php | 47 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/languages/Language.php b/languages/Language.php index 8b5c9c7eb9..1f9a47556a 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1984,6 +1984,13 @@ class Language { return wfMsg($wgWeekdayNamesEn[$key-1]); } + /** + * Used by date() and time() to adjust the time output. + * @access public + * @param int $ts the time in date('YmdHis') format + * @param mixed $tz adjust the time by this amount (default false) + * @return int + */ function userAdjust( $ts, $tz = false ) { global $wgUser, $wgLocalTZoffset; @@ -2013,6 +2020,18 @@ class Language { return date( 'YmdHis', $t ); } + /** + * @access public + * @param mixed $ts the time format which needs to be turned into a + * date('YmdHis') format with wfTimestamp(TS_MW,$ts) + * @param bool $adj whether to adjust the time output according to the + * user configured offset ($timecorrection) + * @param mixed $format what format to return, if it's false output the + * default one. + * @param string $timecorrection the time offset as returned by + * validateTimeZone() in Special:Preferences + * @return string + */ function date( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false ) { global $wgAmericanDates, $wgUser; @@ -2043,7 +2062,19 @@ class Language { default: return "$month $day, $year"; } } - + + /** + * @access public + * @param mixed $ts the time format which needs to be turned into a + * date('YmdHis') format with wfTimestamp(TS_MW,$ts) + * @param bool $adj whether to adjust the time output according to the + * user configured offset ($timecorrection) + * @param mixed $format what format to return, if it's false output the + * default one. + * @param string $timecorrection the time offset as returned by + * validateTimeZone() in Special:Preferences + * @return string + */ function time( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false ) { global $wgUser, $wgAmericanDates; $ts=wfTimestamp(TS_MW,$ts); @@ -2058,12 +2089,26 @@ class Language { } if ($datePreference == '0') {$datePreference = $wgAmericanDates ? 1 : 2;} $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ); + if ( $format == 'ISO 8601' ) { $t .= ':' . substr( $ts, 12, 2 ); } return $this->formatNum( $t ); } + /** + * @access public + * @param mixed $ts the time format which needs to be turned into a + * date('YmdHis') format with wfTimestamp(TS_MW,$ts) + * @param bool $adj whether to adjust the time output according to the + * user configured offset ($timecorrection) + * @param mixed $format what format to return, if it's false output the + * default one. + * @param string $timecorrection the time offset as returned by + * validateTimeZone() in Special:Preferences + * @param ??? $dateandtime ??? (default false) + * @return string + */ function timeanddate( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false, $dateandtime = false) { global $wgUser, $wgAmericanDates; $ts=wfTimestamp(TS_MW,$ts); -- 2.20.1