use strict; use warnings; use Time::Piece; use feature 'say'; my $date = Time::Piece->strptime( localtime->year() - 4 . " 01 01", "%Y %m %d" ); my $endDate = localtime(); while ( $date <= $endDate ) { say $date; # Get the next first of the month by going to the end of the # month and add one day my $year = $date->year; my $mon = $date->mon; my $day = $date->month_last_day; $date = Time::Piece->strptime( "$year $mon $day", "%Y %m %d" ) +; $date += Time::Seconds::ONE_DAY; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC: List of first day of each month
by haukex (Archbishop) on Jan 31, 2020 at 16:47 UTC | |
|
Re: RFC: List of first day of each month
by choroba (Cardinal) on Jan 31, 2020 at 15:28 UTC | |
|
Re: RFC: List of first day of each month
by 1nickt (Canon) on Jan 31, 2020 at 15:53 UTC | |
by Your Mother (Archbishop) on Jan 31, 2020 at 17:07 UTC | |
|
Re: RFC: List of first day of each month
by hippo (Archbishop) on Jan 31, 2020 at 16:27 UTC | |
|
Re: RFC: List of first day of each month -- oneliner
by Discipulus (Canon) on Jan 31, 2020 at 20:09 UTC | |
|
Re: RFC: List of first day of each month
by Tux (Canon) on Jan 31, 2020 at 16:03 UTC | |
|
Re: RFC: List of first day of each month
by cavac (Prior) on Feb 17, 2020 at 16:20 UTC |