From: rretzbach Date: 2007-03-08T17:40:06+09:00 Subject: Re: Convert country name to country code On 8 Mrz., 04:39, Petr Janda wrote: > Ive got the TZInfo library installed, and I am able to convert a country > code into country name, but I want to do it the other way around. Is it > possible? > > Thanks, > Petr > > -- > Posted viahttp://www.ruby-forum.com/. I just took a small glimpse on the API doc and think it's not possible with tzlib, cause they have a countries hash in the Form: {code => name} add the following method to country.rb: def self.get_code(identifier) load_index Indexes::Countries.countries.keys.find{|code| a[code] == identifier} end Then you should be able to do Country.get_code("Germany"). Good luck :)