in reply to RFC: List of first day of each month
Hi,
I eschew Time::Piece for date math. It has some weird internal issues with constants and overloading, which I don't completely understand, but people I trust including some wiser and more experienced Monks than I, recommend against it. (See e.g. comments in this discussion.)
Alternate solution using Time::Moment which IIUC is as accurate as DateTime but considerably lighter-weight:
Output:use v5.10; use Time::Moment; my $tm1 = Time::Moment->new(year => '2019', month => '6', day => '1'); my $tm2 = Time::Moment->now; $tm1 = (say $tm1->strftime('%c') and $tm1->plus_months(1)) while $tm1 +<= $tm2;
Mon Jul 1 00:00:00 2019 Thu Aug 1 00:00:00 2019 Sun Sep 1 00:00:00 2019 Tue Oct 1 00:00:00 2019 Fri Nov 1 00:00:00 2019 Sun Dec 1 00:00:00 2019 Wed Jan 1 00:00:00 2020
Hope this helps!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RFC: List of first day of each month
by Your Mother (Archbishop) on Jan 31, 2020 at 17:07 UTC |