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
This commit is contained in:
parent
6b366c6620
commit
efe9a3eb21
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user