Y
Y
Yuriy2015-09-03 16:52:58
Working with date/time
Yuriy, 2015-09-03 16:52:58

Why does Wordpress 4.3 print date() incorrectly?

Tell me what kind of bug with time in wordpress?
I just display the date on the page <?=date('dmY H:i:s')?> I get 3 hours less than MSK
in the settings, everything seems to be fine ... if I output it to a file separately from wordpressa, then it shows the time correctly ..
WP version 4.3
aa28fbc84f28471580672253e02416d0.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MetaDone, 2015-09-03
@MetaDone

$tz = 'Europe/Moscow';
$timestamp = time();
$dt = new DateTime("now", new DateTimeZone($tz)); 
$dt->setTimestamp($timestamp); 
echo $dt->format('d.m.Y, H:i:s');

Something like this will display according to the set time zone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question