From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: strftime: Need Help with Time Offsets Date: Tue, 26 Dec 2000 23:36:05 +0000 Organization: Customer of Energis Squared Lines: 27 Message-ID: <419i4tsoc9dgtbp9okme2cghdn09uocgq4@4ax.com> References: <1a524t0tk28cmv3vqfq26tooe0qeikhgm5 AT 4ax DOT com> <2561-Fri22Dec2000120234+0200-eliz AT is DOT elta DOT co DOT il> <1190-Fri22Dec2000173248+0200-eliz AT is DOT elta DOT co DOT il> <0nt94tkh5ptfohe9414da1u3geja7ml4vm AT 4ax DOT com> <20001226124727 DOT A19514 AT kendall DOT sfbr DOT org> NNTP-Posting-Host: modem-121.magnesium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news5.svr.pol.co.uk 977873789 24376 62.136.11.121 (26 Dec 2000 23:36:29 GMT) NNTP-Posting-Date: 26 Dec 2000 23:36:29 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com JT Williams 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.