On Apr 2, 9:00 pm, [EMAIL PROTECTED] (Jennifer G.) wrote:
> How do I know this day is in NO. which week in this year?
> for example, Jan 1 is in the no.1 week of this year.
> but how about the current day?
This seems to be a frequently asked question:
http://perldoc.perl.org/perlfaq4.html#How-do-
Jennifer G. wrote:
> How do I know this day is in NO. which week in this year?
> for example, Jan 1 is in the no.1 week of this year.
> but how about the current day?
It's a little more complicated than that. Week one is the first week in
the year that has four or more days, so if Jan 1 falls on a
Jennifer G. wrote:
How do I know this day is in NO. which week in this year?
for example, Jan 1 is in the no.1 week of this year.
but how about the current day?
It depends on how you define "week". The simple answer is:
$ perl -le'print int( ( localtime )[ 7 ] / 7 )'
13
Perhaps have a look
If you are calculating it your self and assuming you are intrested in the
ISO defenition of the week number: http://www.proesite.com/timex/wkcalc.htm
Of course there are modules on CPAN that do the same but then again, if all
you want to know is the number of the week it might be simpler to calcul