in reply to Getting the current week number
5) How do I calculate the number of the week of month the current date lies in?
April 1998
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 = week #1
6 7 8 9 10 11 12 = week #2
13 14 15 16 17 18 19 = week #3
20 21 22 23 24 25 26 = week #4
27 28 29 30 = week #5
use Date::Calc qw( Today Day_of_Week ); my ($year,$month,$day) = Today(); my $week = int(($day + Day_of_Week($year,$month,1) - 2) / 7) + 1;
Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarantees offense.
|
|---|