Rails BST timezone implementation

戏子无情 提交于 2019-12-01 08:20:37

问题


Does anyone know how i can use BST for config.time_zone in my rails config/environment.rb file?

At the moment i have left it as UTC and i'm thinking of adding BST to the list of supported timezones, and then extending the Time class to respect this (> last sunday of X month + 1hr)

Where can i find the list of supported timezones?

Searching around i have found alot of complaints but not alot of answers. this will be up on guthub asap.

Cheers, Dougle


回答1:


rake time:zones:all

You'll probably see a time zone named London, which is just UTC +00:00, but should handle UK daylight saving time properly.




回答2:


The TimeZone you need to set is UK, this will automatically handle BST

Time.zone = 'London'
Time.zone.now
 => Sun, 17 Oct 2010 02:09:54 BST +01:00


来源:https://stackoverflow.com/questions/1340037/rails-bst-timezone-implementation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!