[wp-trac] [WordPress Trac] #48858: Incorrect UTC time in WP 5.3
WordPress Trac
noreply at wordpress.org
Tue Dec 3 12:50:30 UTC 2019
#48858: Incorrect UTC time in WP 5.3
--------------------------+------------------------------
Reporter: balykin95 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: 5.3
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by Rarst):
Oookay, I think I see a code path that breaks for you there (`date_i18n()`
with GMT flag).
Let's try this please:
{{{#!php
var_dump(
'date_i18n() / GMT: ' . date_i18n( DATE_RFC3339, false, true ),
'wp_date() / UTC: ' . wp_date( DATE_RFC3339, null, new
DateTimeZone( 'UTC' ) ),
'UTC offset: ' . ( new DateTimeZone( 'UTC' ) )->getOffset( new
DateTime( 'now' ) ),
'date_create() / default: ' . date_create( '@' . time() )->format(
DATE_RFC3339 ),
'date_create() / UTC: ' . date_create( '@' . time()
)->setTimezone( new DateTimeZone( 'UTC' ) )->format( DATE_RFC3339 )
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48858#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list