in reply to Re^2: How to find first day of the first week on the month?
in thread How to find first day of the first week on the month?
You could be right. We'll have to wait for devbond to tell us. Anyway, that's just as easy to calculate:
#!/usr/bin/env perl -l use strict; use warnings; use Time::Piece; my $month = 10; my $year = 2013; for (1 .. 7) { # Time::Piece->wday returns: Sunday = 1, ..., Saturday += 7 print +($_ - Time::Piece->strptime("$year$month" . '01', '%Y%m%d') +->wday) % 7 + 1; }
Output:
6 7 1 2 3 4 5
Check:
$ cal 10 2013 October 2013 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-- Ken
|
|---|