TZInfo is a Ruby library that uses the standard tz (Olson) database to provide daylight savings aware transformations between times in different time zones. The tz database is compiled into Ruby modules which are packaged in the release. No external zoneinfo files are required at runtime.
Instructions for installing and using TZInfo can be found in the project readme file.
API Documentation is available.
There are two TZInfo mailing lists:
The RubyForge project page for TZInfo can be found at http://rubyforge.org/projects/tzinfo/.
Please use the Tracker to submit any bugs or feature requests. You can download releases from the File list. The source code is available through SVN.
Scott Barron has written an article on using TZInfo with Ruby on Rails.
Note that the article was based on version 0.0.1 of TZInfo. There is now an easier way to display a drop-down select list of time zones than is described. With TZInfo v0.0.3 and later you can use
<%= time_zone_select 'user', 'time_zone', TZInfo::Timezone.all.sort, :model => TZInfo::Timezone %>
instead of having to use the placeholder TzForSelect class.
Peter Marklund has written a Timezone Aware Datetime Picker recipe that uses TZInfo.
Jamis Buck has released a plugin that replaces the Rails TimeZone class with one that uses TZInfo to do the conversions. To install it run:
ruby script/plugin install tzinfo_timezone
The plugin can be found in the Ruby on Rails SVN repository at http://dev.rubyonrails.org/svn/rails/plugins/tzinfo_timezone/. See the README file for more information.
Ruby/TZFile provides a similar interface to TZInfo, but requires you to have zoneinfo files available locally.
Ruby on Rails provides a simple TimeZone class. This does not have any support for daylight savings.
Phil Ross
28th August 2006