in reply to Getting the current week number
If you mean "which column of the calendar does this date go on, if weeks start with Sunday", then this will do:
From my basic testing, it seems to work for May (which starts on a Saturday), August (which starts on a Sunday), and June (which starts on a weekday) of this year.use POSIX 'ceil'; my $week = 1 + ceil( ($d - $wday - 1) / 7 );
blokhead
|
|---|