Last active
September 22, 2016 18:45
-
-
Save n7st/e5e2d280debec4aa018c858a6e118723 to your computer and use it in GitHub Desktop.
DateMath.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use DateTime; | |
use Data::Printer; | |
my $start = DateTime->new(month => 02, year => 16); | |
my $end = DateTime->new(month => 10, year => 16); | |
for ( | |
my $date = $start; | |
$date->year != $end->year || $date->month <= $end->month; | |
$date->add(months => 1) | |
) { | |
printf("Y: %d m: %d, Start: %d, End: %d\n", | |
$date->year, | |
$date->month, | |
1, | |
DateTime->last_day_of_month(month => $date->month, year => $date->year)->day, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment