brancusi has asked for the wisdom of the Perl Monks concerning the following question:

This must be so simple that I'm overlooking the obvious, and can't believe this hasn't been done on CPAN - but I'm not finding it :( I have an Olsen style timezone of the form "America/New_York" returned by the Geo::IP module and I also know the UTC from my server. How do I convert the UTC into the local time of the person viewing my website given all I have for offset information is the long Olsen type timezone? i.e. how do I convert the Olsen timezone into a NUMERIC offset? TIA Brancusi

Replies are listed 'Best First'.
Re: Converting UTC with Olsen -> Localtime
by rhesa (Vicar) on Sep 15, 2008 at 16:21 UTC
    use DateTime:
    # assuming your server's localtime is in UTC my $local = DateTime->now->set_time_zone( $olson_name );
      Argh! I knew it had to be simple! Many thanks rhesa.
Re: Converting UTC with Olsen -> Localtime
by ysth (Canon) on Sep 15, 2008 at 19:17 UTC
Re: Converting UTC with Olsen -> Localtime
by Anonymous Monk on Sep 15, 2008 at 20:50 UTC
    Date::Manip has functions for doing just about anything with time.

    Steve