Get the isdst flag from localtime
Perl 6 C Makefile
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
resources Fixing DateTime::DST Nov 1, 2017
src Fix typo in Nov 1, 2017
t Set an explicit timezone in tests Nov 1, 2017
.travis.yml Force Travis to use the best timezone :-p Nov 1, 2017 Fixing DateTime::DST Nov 1, 2017
Changes Adding missing Changes Nov 1, 2017
LICENSE Adding LICENSE Jun 30, 2016
META6.json Fixing DateTime::DST Nov 1, 2017 Adding documentation and a README Jun 30, 2016


DateTime::DST - make localtime[8] available as is-dst()


use DateTime::DST;

my $non-dst =, :1month, :15day, :0hour, :0minute, :0second);
my $dst     =, :6month, :15day, :0hour, :0minute, :0second);

say is-dst($non-dst);         # False
say is-dst($non-dst.Instant); # False
say is-dst($non-dst.posix);   # False

say is-dst($dst);             # True
say is-dst($dst.Instant);     # True
say is-dst($dst.posix);       # True


This is nothing too fancy, just exports a function named is-dst which can be used to test for Daylight Savings Time from a DateTime object, an Int (expecting seconds since the start of the POSIX time_t epoch), or an Instant.



multi is-dst(Instant $time) returns Bool
multi is-dst(DateTime $time) returns Bool
multi is-dst(Int $time) returns Bool

Returns True if the C-standard library localtime function returns a true value for the DST flag or False otherwise. This is basically the same as localtime($time)[8] in Perl 5.


Sterling Hanenkamp <>


Copyright 2016 Andrew Sterling Hanenkamp.

This software is made available under the same terms as Perl 6 itself.