slloyd has asked for the wisdom of the Perl Monks concerning the following question:
I searched around and found the following code that gives me the current week number of the year, but I need to know what week of the month it is. Any help would be appreciated.
#!perl # Parse time string ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time +); # Calculate number of full weeks this year $week = int(($yday+1-$wday)/7); # Add 1 if today isn't Saturday if ($wday < 6) {$week +=1;} print "Week $week\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting the current week number
by NetWallah (Canon) on Jun 20, 2004 at 05:18 UTC | |
|
Re: Getting the current week number
by Zaxo (Archbishop) on Jun 20, 2004 at 05:28 UTC | |
|
Re: Getting the current week number
by davido (Cardinal) on Jun 20, 2004 at 05:12 UTC | |
|
Re: Getting the current week number
by matija (Priest) on Jun 20, 2004 at 05:22 UTC | |
|
Re: Getting the current week number
by blokhead (Monsignor) on Jun 20, 2004 at 05:19 UTC | |
|
Re: Getting the current week number
by fglock (Vicar) on Jun 20, 2004 at 05:17 UTC |