Ignore any offset in DateTimes passed in (as is already done for Times). All of the following now refer to the same UTC time (15:40 on 17 April 2006). Previously, the DateTime in the second line would have been interpreted as 20:40.
tz.utc_to_local(DateTime.new(2006, 4, 17, 15, 40, 0)) tz.utc_to_local(DateTime.new(2006, 4, 17, 15, 40, 0).new_offset(Rational(5, 24))) tz.utc_to_local(Time.utc(2006, 4, 17, 15, 40, 0)) tz.utc_to_local(Time.local(2006, 4, 17, 15, 40, 0))
In Ruby on Rails, you can now show a drop-down list of all timezones using the Rails time_zone_select helper method:
<%= time_zone_select 'user', 'time_zone', TZInfo::Timezone.all.sort, :model => TZInfo::Timezone %>
Thanks to Scott Barron of Lunchbox Software for the suggestions in his article about using TZInfo with Rails (https://web.archive.org/web/20060425190845/http://lunchroom.lunchboxsoftware.com/pages/tzinfo_rails)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.