Ruby 'gem tzinfo'

不羁岁月 提交于 2019-12-12 02:29:33

问题


From my previous question about timezones, I decided to use the Ruby gem tzinfo to get access to time zone data. This means storing scheduled times as a timezone name (e.g. "America/Toronto"), and then using the Ruby tzinfo gem and tzinfo database to look up the correct UTC time from a desired local time.

My understanding is that the database of time zones changes from time to time because different jurisdictions call for different policies on the (non)application of Daylight Savings Time.

Once I install the Ruby gem tzinfo, how do I keep the time zone database up to date?

Also, are time-zones ever dropped from the database?


回答1:


From tzinfo.rubyforge.org:

 The tz database is compiled into Ruby modules which are packaged in the release.

So just keeping the gem up to date (with gem update tzinfo) should be sufficient to ensure your timezone files are current.

I don't know whether time zones are ever dropped from the database; I've never noticed dropped timezones myself but to be honest I haven't been looking that hard.



来源:https://stackoverflow.com/questions/9879637/ruby-gem-tzinfo

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