The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Time::Zone -- miscellaneous timezone manipulations routines


        use Time::Zone;
        print tz2zone();
        print tz2zone($ENV{'TZ'});
        print tz2zone($ENV{'TZ'}, time());
        print tz2zone($ENV{'TZ'}, undef, $isdst);
        $offset = tz_local_offset();
        $offset = tz_offset($TZ);


This is a collection of miscellaneous timezone manipulation routines.

tz2zone() parses the TZ environment variable and returns a timezone string suitable for inclusion in date-like output. It opionally takes a timezone string, a time, and a is-dst flag.

tz_local_offset() determins the offset from GMT time in seconds. It only does the calculation once.

tz_offset() determines the offset from GMT in seconds of a specified timezone.

tz_name() determines the name of the timezone based on its offset


Graham Barr <> David Muir Sharnoff <> Paul Foley <>