Skip to content

Instantly share code, notes, and snippets.

@JRaspass
Created October 8, 2019 16:13
Show Gist options
  • Select an option

  • Save JRaspass/e21832e8b6ded2c2767754e5a7df989c to your computer and use it in GitHub Desktop.

Select an option

Save JRaspass/e21832e8b6ded2c2767754e5a7df989c to your computer and use it in GitHub Desktop.
$ perl6 -e '.say for Date.today.truncated-to("month") ... Date.today'
2019-10-01
2019-10-02
2019-10-03
2019-10-04
2019-10-05
2019-10-06
2019-10-07
2019-10-08
OR
use Date::Simple qw/date today/;
my $d1 = date('2019-10-01');
my $d2 = today;
say for map $d1 + $_, 0 .. $d2 - $d1;
OR
perl -MTime::Seconds -MTime::Piece -E '
my $end = localtime;
my $start = Time::Piece->strptime(
$end->strftime("%Y-%m-01"), "%Y-%m-%d");
while ( $start->epoch <= $end->epoch ) {
say $start->ymd;
$start += ONE_DAY;
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment