I’ve got an old database with time zone formats like:
US/Eastern
Australia/Melbourne
In my new Rails app, I’m saving them as:
Eastern Time (US & Canada)
Melbourne
How can I convert the old to the new? I’ve been messing around with ActiveSupport::TimeZone, but can’t figure out the right combination to get from one to the other.
I was hoping I could create a new object, then return the newly formatted name, but it just returns the name I gave it. Example:
> tz = ActiveSupport::TimeZone.new("US/Eastern")
=> (GMT-05:00) US/Eastern
> tz.name
=> "US/Eastern"
Thanks in advance!
This is pretty ugly, but it’s the only way I’ve found to do it:
Edit:
For this code to work with either city or zone, you can do this: