On Fri, Aug 17, 2012 at 11:10 PM, Jim Monty <[email protected]> wrote:
Thanks again Jim, Ted wrote: > > Jim wrote: > > > For a convenient list of all the time zones in the tz database, see > > > http://en.wikipedia.org/wiki/List_of_tz_database_time_zones. > > > > Given that it seems the entries are generaly 'continent/city', is there > > something in DateTime that will take any city or state and lookup the > entry > > for the closest city? Or is that something I'll have to write, based on > > lat/lon data for cities (I am pretty sure I saw a database with lat/lon > > data for cities somewhere, but ... if it already exists, I don't have to > > write it)? > > There aren't any geocoding modules in the Perl DateTime suite (why would > there be?), but there *are* plenty of geocoding Perl CPAN modules. Check > out > the Geo::Coder::* modules, for example. > > The most obvious reason is that there are a great many more cities in this world than are named in the basic timezone. Such a service is essential if you want to support determination of the proper timezone from, e.g., a mailing address. Given that is seems so obvious to me, it is a wonder that someone hasn't alreay written a package that bridges the gap between geo-coding and the timezone database; but maybe one wouldn't be too hard built on something like the geonames database. > If you want to roll your own simple time zone aliases, check out > DateTime::TimeZone::Alias: > > > http://search.cpan.org/dist/DateTime-TimeZone-Alias/ > > The simplest DIY solution is a lookup table using a hash. > > If you want to do something more elaborate, there are oodles of > geocoding resources for programmers on the web: > > > http://en.wikipedia.org/wiki/Geocoding > http://askgeo.com/ > http://askgeo.com/database/TimeZone > > http://www.geonames.org/export/web-services.html#timezone > http://stackoverflow.com/questions/262264/ > http://stackoverflow.com/questions/237023/ > http://stackoverflow.com/questions/55901/ > http://stackoverflow.com/questions/41504/ > > > Jim Monty > > I have begun to study the geonames database, but I hadn't happened up their web services. Thanks again Ted
