Settings → General → Timezone
date_i18n()
, the_date()
, etc.
seconds since 1970–01–01 00:00:00 UTC
$dt = new DateTime();
echo $dt->getTimestamp();
1540645200
echo $dt->format( DATE_RFC3339 );
2018-10-27T16:00:00+03:00
echo $dt->getTimezone()->getName();
Europe/Bucharest
php.net/datetime
setting | gmt_offset | timezone_string |
---|---|---|
Bucharest | 3 | 'Europe/Bucharest' |
UTC+3 | '3' | '' |
timezone_string
gmt_offset
±00:00
(PHP 5.5+)$timezone = WpDateTimeZone::getWpTimezone();
setting | $timezone->getName() |
---|---|
Bucharest | 'Europe/Bucharest' |
UTC+3 | '+03:00' |
Hopefully in wp_date: wp_timezone()
DateTime | date() | date_i18n() | |
---|---|---|---|
language | English | English | WP locale |
time zone | arbitrary | current PHP | current WP |
input | arbitrary | timestamp | “WP timestamp” |
formats | date() | date() | date(), incomplete |
Hopefully in wp_date: wp_date()
echo date_i18n( 'j F Y, \o\r\a G:i T' );
j F Y, \o\r\a G:i T
j \o\c\t\o\m\b\r\i\e Y, \o\r\a G:i T
— localej \o\c\t\o\m\b\r\i\e Y, \o\r\a G:i \E\E\S\T
— zone27 octombrie 2018, ora 16:00 EEST
— date()echo date( DATE_RFC3339, time() );
2018-10-27T13:00:00+00:00
echo date_i18n( DATE_RFC3339, time() );
2018-10-27T13:00:00+03:00
#38771
post_date | post_date_gmt | post_title |
---|---|---|
2018-10-27 14:00:00 | 2018-10-27 13:00:00 | A post made in London |
the_date( DATE_RFC3339 );
2018-10-27T14:00:00+01:00
post_date | post_date_gmt | post_title |
---|---|---|
2018-10-27 14:00:00 | 2018-10-27 13:00:00 | A post made in London |
the_date( DATE_RFC3339 );
2018-10-27T14:00:00+03:00
#38774
post_date_gmt
post_date
post_date[_gmt]
with the time zonepost_date | post_date_gmt | post_title |
---|---|---|
2018-10-27 14:00:00 | 2018-10-27 13:00:00 | A post made in London |
$time = WpDateTime::createFromPost( get_post() );
echo $time->formatI18n( DATE_RFC3339 );
2018-10-27T16:00:00+03:00
Hopefully in wp_date: canonical UTC.
DateTime
to operate timeWpDateTime
to bridge WP and PHP