Tim wrote:
> At 03:16 PM 1/23/04 +0000, you wrote:
>> ...
>> Why not write it yourself?
>> 
>> You need to know:
>> 
>> - Which day of the week is the 'first'.
>> 
>> - Which was the first week of the year that had four or more days.  
>> That's week one. 
>> 
>> Then do the sums/arithmetic/math/mathematics/calculations (what /do/
>> people prefer?) 
>> 
>> .....
>> Rob
> 
> This message thread made me curious about just what constitutes the
> first week of the year. Is there a standard definition or are we
> making one here? 
> 
> Tim

ISO8601 defines a standard, but not everyone follows it. See:

http://www.mcs.vuw.ac.nz/technical/software/SGML/doc/iso8601/ISO8601.html

Excerpt:

"An ordinal date is identified by a given day in a given year. A week is
identified by its number in a given year. A week begins with a Monday, and
the first week of a year is the one which includes the first Thursday, or
equivalently the one which includes January 4."

Here's January, 2004:

 $ cal 1 2004
     January 2004
 Su Mo Tu We Th Fr Sa
              1  2  3
  4  5  6  7  8  9 10
 11 12 13 14 15 16 17
 18 19 20 21 22 23 24
 25 26 27 28 29 30 31

Since weeks start on Monday, the week ending on Sunday, January 4 was week
1.

The DateTime family of modules on CPAN supports this standard.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to