Help language development. Donate to The Perl Foundation
Timezones::US - Provides US time zone data and subroutines for use with modules 'DateTime::US' and 'LocalTime'
use Timezones::US;
Raku module Timezones::US provides constant US time zone data (currently valid through the year 2030) to be used by related date and time dynamic modules.
The following table shows the time zones included:
Name | Symbol | UTC offset (hrs) |
---|---|---|
Atlantic | AST | -4, |
Eastern | EST | -5 |
Central | CST | -6 |
Mountain | MST | -7 |
Pacific | PST | -8 |
Alaska | AKST | -9 |
Hawaii-Aleutian | HAST | -10 |
Samoa | WST | -11 |
Chamorro | CHST | +10 |
The following constants are automatically exported into the using environment:
SEC-PER-HOUR
Seconds per hour: 3600
@tz
A list of time zones (lower-case symbols)
%tzones
A hash of all US time zone abbreviations keyed by their symbols (lower-case) with values of names and UTC offsets
%dst-exceptions
A hash of US time zone abbreviations keyed by their symbols (lower-case) with values of states or regions and details of Daylight Saving exceptions (CAUTION: this an incomplete list at the moment)
%utc-offsets
A hash of US time zone abbreviations keyed by their symbols (lower-case) with value of their UTC offset in hours
%offsets-utc
A hash of US time zone offsets keyed by their hours with value of their symbols (lower-case)
The following subroutines are automatically exported into the using environment:
begin-dst($year --> DateTime) {...}
Return the time when DST (Daylight Saving Time) begins.
end-dst($year --> DateTime) {...}
Return the time when DST ends.
is-dst(DateTime :$localtime! --> Bool) {...}
Return True if the local time is DST, otherwise return False.
is-dst(:$year!, :$month, :$day, :$hour, :$minute, :$second --> Bool) {...}
Return True if the local time is DST, otherwise return False.
show-us-data(--> Str) {...}
List the time zone and DST data being used.
Tom Browder [email protected]
© 2022 Tom Browder
This library is free software; you may redistribute it or modify it under the Artistic License 2.0.