P
P
pantsarny2015-08-30 07:21:41
Yii
pantsarny, 2015-08-30 07:21:41

Yii2 - how to work with the timezone correctly?

Good afternoon, colleagues. There was a following question. A Yii2 application is being developed that runs in the +4 time zone, but the server is located in a different time zone - +2. I don't want to store the time in a timestamp (or do I have to?), but use datetime. There is also no desire to set the wrong time on the server. The web server (php+nginx) must store dates in the +4 zone, but other operations on the server (cron, etc...) must be performed in the server's +2 time zone.
date_default_timezone_set is the correct solution to the situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2015-08-30
@pantsarny

firstly, knowing the difference of 2 hours is already a decision, who prevents the crown from setting the time by subtracting 2 hours?
secondly, in yii in the config, you can specify the time zone
, but you apparently have a problem not with yii, but with setting up the server to work in several time zones

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question