× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I think the following might work:

1) determine the day of the week of Jan 1 for the year in question
2) use this to determine the Julian date of the first Thursday
3) determine the day of the week and Julian value of the date you are
concerned with
4) use these to determine the Julian date of the Thursday that falls
within the same week
5) subtract the Julian day value of the Thursday found in 2) from the
Julian day value of the Thursday found in 4), divide by 7, and add 1

You might also want to consider some special coding for those cases when
you want to know what week Jan 1is in, and it falls on a Friday. . . .

hth

rpg400-l@midrange.com writes:
>I don't have a 400 to test this theory, but if you convert the date to a
>julian type date (*JUL) and then divide the portion of this date that has
>the number of days into the year -by- 7... (should probably round up here)
>Just a guess but should be pretty simple.
>Capt.j
>
>----- Original Message -----
>From: "Andy Youens" <Andy@FormaServe.Co.Uk>
>To: <rpg400-l@midrange.com>
>Sent: February 18, 2002 4:44 AM
>Subject: Week Number Coding
>
>
>Hi all
>
>Does anyone have any sample code for calculating the week number given a
>date?
>
>Couldn't find anything in the archives.
>
>TIA.
>
>Regards
>
>Andy Youens
>FormaServe Systems (UK)
>T: 01908 319566
>F: 01908 316000
>M: 07770 380276
>E: mailto:Andy@FormaServe.Co.Uk
>W: www.FormaServe.Co.Uk



Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA  01376
413-863-4357 x444
mnaughton@juddwire.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.