Geo::IP looks up country by IP Address, and from there you might be able to guess the time zone. There is both a free (gratis) and paid country database:

www.maxmind.com/app/geoip_country

use strict; use warnings; use Geo::IP; use DateTime; use DateTime::TimeZone; my $gi = Geo::IP->new(GEOIP_STANDARD); my $country_code = $gi->country_code_by_addr('24.24.24.24'); print qq{Country:\t$country_code}; my $dt = DateTime->now; foreach my $tz (DateTime::TimeZone->names_in_country($country_code)) { $dt->set_time_zone( $tz ); print $tz . qq{\t} . $dt->hms(); } __END__ $ perl -l 630749.pl Country: US America/New_York 04:19:57 America/Detroit 04:19:57 America/Kentucky/Louisville 04:19:57 America/Kentucky/Monticello 04:19:57 America/Indiana/Indianapolis 04:19:57 America/Indiana/Knox 03:19:57 America/Indiana/Winamac 04:19:57 America/Indiana/Marengo 04:19:57 America/Indiana/Vevay 04:19:57 America/Chicago 03:19:57 America/Indiana/Vincennes 03:19:57 America/Indiana/Petersburg 03:19:57 America/Menominee 03:19:57 America/North_Dakota/Center 03:19:57 America/North_Dakota/New_Salem 03:19:57 America/Denver 02:19:57 America/Boise 02:19:57 America/Shiprock 02:19:57 America/Phoenix 01:19:57 America/Los_Angeles 01:19:57 America/Anchorage 00:19:57 America/Juneau 00:19:57 America/Yakutat 00:19:57 America/Nome 00:19:57 America/Adak 23:19:57 Pacific/Honolulu 22:19:57
--
Andreas

In reply to Re: How to get client-side's localtime from the server-side by andreas1234567
in thread How to get client-side's localtime from the server-side by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.