in reply to (kudra: 4 jan is in week 1) RE: Date::Manip week-of-year
in thread Date::Manip week-of-year

Ok, question:
<dunce cap> Why is the first week defined that way? </dunce cap>
eerrr.... maybe I had best leave it on....

Roy Alan

Replies are listed 'Best First'.
RE: RE: (kudra: 4 jan is in week 1) RE: Date::Manip week-of-year
by Fastolfe (Vicar) on Oct 04, 2000 at 20:52 UTC
    I believe Date::Manip treats the first week of the year as the week that January 1st is in. A week is still Sunday -> Saturday (or Monday -> Sunday?), so if January 1st is on a Friday, several of the days at the end of December will be treated as being part of the first week of that year.

    How would you define it? With varying "week" boundaries? One year a week starts on a Wednesday, the next it starts on a Friday? Would you break up a week into two pieces, calling the first piece week 52 and the 2nd piece week 1?

    It makes sense in a weird sort of way.

      From perldoc Date::Manip...
      ** Note that the formats "sunday week 22" and "22nd sunday" give very different bahaviors. "sunday week 22" returns the sunday of the 22nd week of the year based on how week 1 is defined. ISO 8601 defines week one to contain Jan 4, so "sunday week 1" might be the first or second sunday of the current year, or the last sunday of the previous year. "22nd sunday" gives the actual 22nd time sunday occurs in a given year, regardless of the definition of a week.

      -- Randal L. Schwartz, Perl hacker

        hhhhhhhhhmmmmmmmm......
        wouldn't you know it's those funny little ISO guys making up something like that.. geee
        thanks Randal

        Roy Alan