|
|
|
# Importing methods. use Time::Zones; use Time::Zones qw(English); use Time::Zones qw(Dutch); # Getting different timezone values my @GMTTimeArray = tztime("GMT"); # same as gmtime() my @WestEuropeTime = tztime("WEUR"); # +01:00 my @AlaskaTime = tztime("ALASK"); # -09:00 my @NepalTime = tztime("NEPAL"); # +05:45 # Printing all timezone names sorted. my @tzConstants = sort timezones tzkeys(); my $nameshash = tznames(); foreach my $tz (@tzConstants) { print $nameshash->{$tz} . "\n"; }
When a language parameter is provided, the module attemps to load timezone names from a language file. The hash will be available as the %Time::Zones::Names variable. The language file however, should be present at the users system (Time::Zones::LanguageName)
In scalar context, the function will return a time string, just like gmtime() and localtime(). For more details about the return values, please check the documentation of localtime() or gmtime().
my @tzsort = sort timezones tzkeys() # As Of Perl 5.005;my @tzsort = sort { timezones($a, $b) } tzkeys();
The function returns a reference to the timezone names hash when the first parameter is omitted. You can use that reference when you need to know much more of those names, theirby saving a lot of function calls.
my $names = tznames(); # Getting a hash reference my $weur1a = $names->{WEUR}; # Using that reference my $weur1b = tznames->{WEUR}; # Same, not saving the reference my $weur2 = tznames("WEUR"); # Using tznames' return value
CONSTANT_ID => DATA_ARRAY_REFERENCE #1: Basic Structure "CONSTANT" => [( DATA_ARRAY )] #2: Written in Perl
The data array has one of the following formats:
Time Zone Offset from GMT, without any DST. [+-]H,M Offset Start DST (Nth weekday) End of DST DST Offset [+-]H,M, [1st-5th],DAY,MON,H,M,S, [1-5],DAY,MON,H,M,S, [+-]H,M