DateTime::TimeZone (Perl 6)
Perl 6
Switch branches/tags
Nothing to show
Clone or download
supernovus Merge pull request #14 from zoffixznet/patch-1
Fill in missing "authors" field
Latest commit 7b5369e Oct 2, 2017



TimeZone handling for Perl 6.


tz-offset(Str $offset-string) --> Int

Parses common offset strings and returns an Int value.

timezone(Str $name, DateTime $datetime?) --> DateTime::TimeZone

Returns a TimeZone object representing the zone passed to it. These objects provide an .Int call, so they may be used directly as the :timezone parameter for a DateTime object.

This will support any timezone listed in the Olson database.

The $datetime is used to calculate the offset depending on Daylight Savings Time rules for the given Time Zone.

If $datetime is not passed, it assumes;

to-timezone(Str $name, DateTime $datetime)

A shortcut for: $$name, $datetime));


This is very much under development, and currently only the tz-offset() subroutine is supported.



Artistic License 2.0