From efe9a3eb216b30062b5682fbc0affceebde56e92 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Jun 2018 13:18:13 +0000 Subject: [PATCH] Docs: Improve documentation for `date_i18n()`'s second argument. Despite previously being labeled as a Unix timestamp, in reality it's a sum of Unix timestamp and timezone offset in seconds. Props Rarst. See #38771. git-svn-id: https://develop.svn.wordpress.org/trunk@43380 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 60229ee10b..3b8ed27b20 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -74,7 +74,8 @@ function current_time( $type, $gmt = 0 ) { } /** - * Retrieve the date in localized format, based on timestamp. + * Retrieve the date in localized format, based on a sum of Unix timestamp and + * timezone offset in seconds. * * If the locale specifies the locale month and weekday, then the locale will * take over the format for the date. If it isn't, then the date format string @@ -84,15 +85,16 @@ function current_time( $type, $gmt = 0 ) { * * @global WP_Locale $wp_locale * - * @param string $dateformatstring Format to display the date. - * @param bool|int $unixtimestamp Optional. Unix timestamp. Default false. - * @param bool $gmt Optional. Whether to use GMT timezone. Default false. + * @param string $dateformatstring Format to display the date. + * @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset in seconds. + * Default false. + * @param bool $gmt Optional. Whether to use GMT timezone. Default false. * * @return string The date, translated if locale specifies it. */ -function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { +function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = false ) { global $wp_locale; - $i = $unixtimestamp; + $i = $timestamp_with_offset; if ( false === $i ) { $i = current_time( 'timestamp', $gmt ); @@ -147,7 +149,7 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { * * @param string $j Formatted date string. * @param string $req_format Format to display the date. - * @param int $i Unix timestamp. + * @param int $i A sum of Unix timestamp and timezone offset in seconds. * @param bool $gmt Whether to convert to GMT for time. Default false. */ $j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );