Make WordPress Core


Ignore:
Timestamp:
06/26/2018 01:18:13 PM (6 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r43284 r43380  
    7575
    7676/**
    77  * Retrieve the date in localized format, based on timestamp.
     77 * Retrieve the date in localized format, based on a sum of Unix timestamp and
     78 * timezone offset in seconds.
    7879 *
    7980 * If the locale specifies the locale month and weekday, then the locale will
     
    8586 * @global WP_Locale $wp_locale
    8687 *
    87  * @param string   $dateformatstring Format to display the date.
    88  * @param bool|int $unixtimestamp    Optional. Unix timestamp. Default false.
    89  * @param bool     $gmt              Optional. Whether to use GMT timezone. Default false.
     88 * @param string   $dateformatstring      Format to display the date.
     89 * @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset in seconds.
     90 *                                        Default false.
     91 * @param bool     $gmt                   Optional. Whether to use GMT timezone. Default false.
    9092 *
    9193 * @return string The date, translated if locale specifies it.
    9294 */
    93 function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
     95function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = false ) {
    9496    global $wp_locale;
    95     $i = $unixtimestamp;
     97    $i = $timestamp_with_offset;
    9698
    9799    if ( false === $i ) {
     
    148150     * @param string $j          Formatted date string.
    149151     * @param string $req_format Format to display the date.
    150      * @param int    $i          Unix timestamp.
     152     * @param int    $i          A sum of Unix timestamp and timezone offset in seconds.
    151153     * @param bool   $gmt        Whether to convert to GMT for time. Default false.
    152154     */
Note: See TracChangeset for help on using the changeset viewer.