Convert Rails TimeZone name to MySQL timezone name?

For various reasons we need to use the CONVERT_TZ() function in mysql to
convert times during queries. The timezone to be used in the conversion
is based on the timezone the user selected when setting up their profile
(from a select box populated with ActiveSupport::TimeZone.us_zone).

The problem is that the zone names in rails differ from the names in
MySQL.

In rails we have a name like “Eastern Time (US & Canada)”. MySQL has
the equivalent as the following: “US/Eastern”

Obviously we could write some name mapping thingy or munge the names in
MySQL time_zone_name file. I’m just wondering if anyone has already
been down this path and has a canned solution.

Thanks in advance.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs