WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #42451


Ignore:
Timestamp:
11/07/2017 03:06:56 AM (4 years ago)
Author:
dd32
Comment:

Hi @taojing10,

Can you clarify what issues you are seeing are?

time() is always expressed as a UTC offset, it's timezone independent. Theoretically, gmdate() should be returning the same date as time() is in your example here.

I suspect the situation you're experiencing may be a mismatch between server timezones and your PHP configuration, but it's not clear from your report if this is indeed the issue you're experiencing.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #42451

    • Property Keywords reporter-feedback added
    • Property Component changed from General to Date/Time
  • Ticket #42451 – Description

    initial v1  
    11in wp-includes/functions.php, look for
    2 
    3                 case 'timestamp':
    4                         return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
     2{{{
     3case 'timestamp':
     4        return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
     5}}}
    56change to
    6                 case 'timestamp':
    7                         //return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    8                         return ( $gmt ) ? strtotime(gmdate('Y-m-d H:i:s')) : strtotime(gmdate('Y-m-d H:i:s')) + ( get_option( 'gmt_offset' ) * 3600 );
    9 
     7{{{
     8case 'timestamp':
     9        //return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
     10        return ( $gmt ) ? strtotime(gmdate('Y-m-d H:i:s')) : strtotime(gmdate('Y-m-d H:i:s')) + ( get_option( 'gmt_offset' ) * 3600 );
     11}}}
    1012This issue because of php timestamp function.