Answer the question
In order to leave comments, you need to log in
How to properly set time with timezones in yii2+js?
I work locally, my zone is +7, when time() outputs the time according to the time zone +00, I set the time zone Yii::$app->setTimeZone('Europe/Moscow'); time() also displays +00 , but date('dmy H:i:s') is displayed in Moscow,
<div class="time" data-time="<?= time()?>">
<script>
var time = $('.time').attr('data-time');
var date = time * 100;//значение выводится по поясу +7,
</script>
Answer the question
In order to leave comments, you need to log in
time() is time zone independent. This is the timestamp in seconds since Jan 1, 1970 00:00:00 GMT
GMT, Carl
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question