I might be missing something, but I don't see a function in Date::Calc. Here's a DateTime solution:
use DateTime; my $dt = DateTime->now; my $date = $dt->strftime("%b %Y"); my $week = $dt->week_of_month(); print "It is Week: $week As of $date\n"; __END__ It is Week: 2 As of Oct 2017
However, note that the week number returned here can be zero - from the DateTime docs on week_of_month:
The first week of the month is the first week that contains a Thursday. This is based on the ICU definition of week of month, and correlates to the ISO8601 week of year definition. A day in the week before the week with the first Thursday will be week 0.
So you need to have a clear definition of what the Nth week means for you. (Update: LanX made the same point here.)
In reply to Re: I want to know the current week number of the current month
by haukex
in thread I want to know the current week number of the current month
by Muskovitz
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |