use warnings; use strict; use Time::Piece qw(); for my $date (qw(2016-04-01 2016-03-25)) { my $t = Time::Piece->strptime($date, '%Y-%m-%d'); my $day_of_month = $t->day_of_month(); my $week_of_month = int($day_of_month/7) + 1; print "Week $week_of_month of ", $t->fullmonth(), "\n"; } __END__ Week 1 of April Week 4 of March
In reply to Re: Week number of the month
by toolic
in thread Week number of the month
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |