I like DateTime for all my date/time needs, and there is the extension DateTime::Event::Recurrence. And for more complex recurrences, you can use DateTime::Set. In addition, there is DateTime::Event::ICal.
use warnings;
use strict;
use DateTime;
use DateTime::Event::Recurrence;
my $set = DateTime::Event::Recurrence->monthly(days=>7);
my @list = $set->as_list(
start => DateTime->new( year=>2018 ),
end => DateTime->last_day_of_month( year=>2018, month=>12 ) );
print $_->ymd,"\n" for @list;
__END__
2018-01-07
2018-02-07
2018-03-07
2018-04-07
2018-05-07
2018-06-07
2018-07-07
2018-08-07
2018-09-07
2018-10-07
2018-11-07
2018-12-07
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.