On 22/10/2007, Sanjay Vakil <[EMAIL PROTECTED]> wrote: > What I'd like to do is to show the "simpler" names of timezones, > rather than the city name: > > EST instead of America/New_York > PST instead of America/Los_Angeles > > Is there a way to derive this? > > I looked at linked_zones, thinking I could use those, but they don't > appear to link back to the country in question, or the zone that they > link to.
Linked timezones are just aliases to other zones. TZInfo hides the details of the linked timezone. There is no link from a timezone to the country or countries that use it. You could use the information available through the Country class to build such an index though. > At minimum, from a UI standpoint, it'd be nice to show something like: > > EST - New York If you are interested in seeing EST/EDT, etc, then you can obtain a TimezonePeriod object using Timezone#current_period, Timezone#period_for_utc or Timezone#period_for_local and call its abbreviation method. The New York part can be obtained by calling Timezone#friendly_identifier(true) Phil -- Phil Ross http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby _______________________________________________ TZInfo-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/tzinfo-users
