Time::ZoneInfo
Section: User Contributed Perl Documentation (3)
Updated: 2018-09-19
Page Index
NAME
Time::ZoneInfo - Perl extension for returning a list of Time Zones...
SYNOPSIS
use Time::ZoneInfo;
my $zones = Time::ZoneInfo->new();
foreach my $zone ($zones->zones) {
# print $zone->zone . ' - ' . $zone->offset . "\n";
print $zone . "\n";
}
if (my $zone = Time::ZoneInfo->current_zone) {
my ($latitude, $longitude) = $zones->latitude_longitude_sexagesimal($zone);
print "$zone: ", $zones->country($zone), " $latitude $longitude\n";
}
DESCRIPTION
An
OO interface to accessing a list of timezones. This is useful if you
want to provide an interface for your user to choose one of the available
time zones.
Version 0.3.1 also gives the geolocalisation for a time zone.
METHODS
new
You can specify the zonetab file by passing in zonetab => 'file/location'
regions
Return an array (or array ref) to the list of regions
zones ([region])
Return zones (optionally just for one region)
country (zone)
Return the country associated with the given zone
current_zone
Return the current zone configured
latitude_decimal(zone)
Return the latitude for the given zone using decimal notation.
latitude_sexagesimal(zone)
Return the latitude for the given zone using sexagesimal notation
(eg: 51_30'30"N)
longitude_decimal(zone)
Return the longitude for the given zone using decimal notation.
longitude_sexagesimal(zone)
Return the longitude for the given zone using sexagesimal notation
(eg: 00_07'31"E)
latitude_longitude_decimal(zone)
Return a list of two elements: the latitude and longitude for the given zone using decimal notation.
latitude_longitude_sexagesimal(zone)
Return a list of two elements: the latitude and longitude for the given zone using sexagesimal notation
(eg: 51_30'30``N and 00_07'31''E)
=
ERRORS
You can read
$Time::ZoneInfo::ERROR for an error message at any time.
CONTRIBUTIONS
Thanks to Richard Carver <
cpan.org-rnc@thecarverzone.com> for finding
issues processing comments.
Pascal ``Pixel'' Rigaux added geolocalisation
AUTHOR
Scot Penrose, <
scott@cpan.org>
SEE ALSO