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.
Built from https://develop.svn.wordpress.org/trunk@43380


git-svn-id: http://core.svn.wordpress.org/trunk@43208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-06-28 02:44:12 +00:00
parent be6aa715fe
commit b98ef36c97
2 changed files with 10 additions and 8 deletions

View File

@ -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 * 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 * 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 * @global WP_Locale $wp_locale
* *
* @param string $dateformatstring Format to display the date. * @param string $dateformatstring Format to display the date.
* @param bool|int $unixtimestamp Optional. Unix timestamp. Default false. * @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset in seconds.
* @param bool $gmt Optional. Whether to use GMT timezone. Default false. * Default false.
* @param bool $gmt Optional. Whether to use GMT timezone. Default false.
* *
* @return string The date, translated if locale specifies it. * @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; global $wp_locale;
$i = $unixtimestamp; $i = $timestamp_with_offset;
if ( false === $i ) { if ( false === $i ) {
$i = current_time( 'timestamp', $gmt ); $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 $j Formatted date string.
* @param string $req_format Format to display the date. * @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. * @param bool $gmt Whether to convert to GMT for time. Default false.
*/ */
$j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt ); $j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-43379'; $wp_version = '5.0-alpha-43380';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.