Notes posted by stadiv
RSS feed
1 thank
Rails v2.1.0 has built-in time-zone support
Rails versions as of 2.1.0 have basic timezone support built-in to the Time object. However, to get a list of all the timezones you need to install the tzinfo gem.
TZInfo::Country.all.sort_by { |c| c.name }.each do |c| puts c.name # E.g. Norway c.zones.each do |z| puts "\t#{z.friendly_identifier(true)} (#{z.identifier})" # E.g. Oslo (Europe/Oslo) end end
TZInfo::TimeZone.get(identifier) returns a TimeZone -object by the identifier.