Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Auto detect timezone

10 views
Skip to first unread message

Rajesh Raghammudi

unread,
May 25, 2009, 8:42:12 AM5/25/09
to beginn...@perl.org
Hello,

I need to detect the timezone based on Date, City(State/ZIP), Country(USA
for now) as part of my application.

Any idea about a perl module which does the above?

Thanks,
Rajesh

Greg Jetter

unread,
May 25, 2009, 2:39:57 PM5/25/09
to beginn...@perl.org

you might have to roll your own , you should be able to create a hash table
of states/timezone from readily available data sources .

Greg

Randal L. Schwartz

unread,
May 25, 2009, 6:44:55 PM5/25/09
to beginn...@perl.org
>>>>> "Jayesh" == Jayesh Thakrar <j_th...@yahoo.com> writes:

Jayesh> There's a webservice that you can invoke. See -

Jayesh> http://www.xmethods.net/ve2/ViewListing.po?key=uuid:6F25C11C-7087-73ED-20B8-71AF6DC69E42

Jayesh> And you can use SOAP:Lite to query the web service with minimal effort.

Ugh. If "SOAP" is part of your answer, you asked the wrong question.

See Geo::GeoNames in the CPAN:

use Geo::GeoNames;
my $result = Geo::GeoNames->new->search(q => 'Portland, Oregon',
maxRows => 1,
style => 'FULL');
print $result->[0]{timezone}{content}, "\n";

==>

America/Los_Angeles

As I would expect.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<mer...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

0 new messages