Mail Archives: djgpp/2000/12/26/19:16:12
JT Williams <jeffw AT darwin DOT sfbr DOT org> wrote:
> -: If someone has the time to figure out the calculation for week numbers
> -: (%V) from any supplied date, that would help.
>
> Take a look in "Astronomical Algorithms", by Jean Meeus.
Erm, the week no's required for strftime() have nothing to do with the
position of the planets. ;-)
(IOW, If that reference is appropriate please can you expand it.)
This is what needs to be figured out:
: In this system, weeks begin on a Monday and week 1 of the year is the
: week that includes January 4th, which is also the week that includes
: the first Thursday of the year, and is also the first week that
: contains at least four days in the year. If the first Monday of
: January is the 2nd, 3rd, or 4th, the preceding days are part of the
: last week of the preceding year; thus, for Saturday 2nd January 1999,
: %G is replaced by 1998 and %V is replaced by 53. If December 29th,
: 30th, or 31st is a Monday, it and any following days are part of week
: 1 of the following year. Thus, for Tuesday 30th December 1997, %G is
: replaced by 1998 and %V is replaced by 1.
The week number, %V as defined above, needs to be calculated from the
date fields of a struct tm.
- Raw text -