Find the last Sunday of each month: Difference between revisions

m
→‎{{header|Perl 6}}: fixed Date routine args
(+Stata)
m (→‎{{header|Perl 6}}: fixed Date routine args)
Line 2,662:
=={{header|Perl 6}}==
 
{{works with|rakudo|20162018.0803}}
<lang Perl6>sub MAIN ($year = Date.today.year) {
for 1..12 -> $momonth {
my $month-end = Date.new($year, $momonth, Date.days-in-monthnew($year, $momonth,1).days-in-month);
say $month-end - $month-end.day-of-week % 7;
}
}</lang>
 
{{out|input=20152018}}
<pre>20152018-01-2528
20152018-02-2225
20152018-03-2925
20152018-04-2629
20152018-05-3127
20152018-06-2824
20152018-07-2629
20152018-08-3026
20152018-09-2730
20152018-10-2528
20152018-11-2925
20152018-12-2730</pre>
 
=={{header|Phix}}==
2,392

edits