[wp-trac] [WordPress Trac] #38642: current_time('mysql') and current_time('Y-m-d H:i:s') are returning different values
WordPress Trac
noreply at wordpress.org
Thu Nov 3 04:45:58 UTC 2016
#38642: current_time('mysql') and current_time('Y-m-d H:i:s') are returning
different values
--------------------------+------------------------------
Reporter: yeetien | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: 4.6.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by dd32):
Hi @yeetien and welcome back to Trac.
WordPress operates with it's internal default timezone set to UTC, so
under normal situations `date()`, `gmdate()` and `time()` should all be
returning the same timezone data - UTC (See #10940)
In your case, it sounds like the default date timezone is set to something
other than UTC, most likely because a plugin is incorrectly calling
`date_default_timezone_set()`, which would result in the scenario you're
reporting.
Now that being said, I see no reason why this function is using both
`gmdate()` and `date()`, but even fixing this you're likely to other dates
being off elsewhere in WordPress where `date()` is used in the expectation
that it's been set to UTC.
What timezone do you have WordPress set to? What about the PHP default
timezone? Do you still experience it without plugins and using a default
theme?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38642#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list