开发者

Symfony + Timezones: (automatic) conversion between user and server timezone?

I have an existing Symfony 1.2/Propel project which has been modified to run in various other languages/timezones. The current hardware setup and most of the languages will run in CET, but some languages will operate in different timezones.

Is there any chance I can easily convert user datetime inputs from, let's say BST to CET and vice-versa, without touching all cal开发者_开发问答ls to DateTime-functions/FormWidgets?


No, but you could add a filter to the filter chain that executes a SET TIME_ZONE = ? query on the open database connection before any other queries are sent... to set it to the user's time zone.

Beyond that, good time zone support requires some coding. I usually end up implementing all the conversions from GMT (which I store all datetimes in) to the user's local time zone or vice versa in the model classes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜