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

Dear Monks

I'm writing a tool to convert dates. Something that would be nice is to allow input dates from differen timezones. So I would like to enable the user to define one. Is there a function that shows the available abbreviation and maybe also the full name of the TZs (or something like that) ?

Thanks a lot
Luca

Replies are listed 'Best First'.
Re: Date::Manip, how to view available TZ
by salva (Canon) on Feb 14, 2006 at 12:53 UTC
    Date::Manip is not your best option for converting times between different timezones as it doesn't support daylight savings offsets.

    Try DateTime and DateTime::TimeZone that BTW, exports a function to get the names of all the available TZs: DateTime::TimeZone::all_names()

      Thnx a lot. Is it possible to make a list like:
      Europe Amsterdam (CET) etc Africa ..

      So far I can:
      my @cat = DateTime::TimeZone::categories() ; foreach (@cat) { my @b = DateTime::TimeZone::names_in_category( $_ ) ; print "$_:\n" ; foreach (@b) { print " $_\n" ; } etc ; }
      How do I convert something like Africa/Abidjan to a short name abbreviation ?

      Luca