Thanks Martin.

I've heard of several algorhythms similar to this and was curious what Pick
used. Every time I tried my own expressions I either came up short on
covering all dates or it was way too time consuming. Of course I wasn't
writing it in assembler or other lower (faster) code either.

Thanks.
----- Original Message -----
From: "Martin Phillips" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, July 21, 2007 6:47 PM
Subject: Re: [U2] [UV] Conversion code for week number


> Hi Mark,
>
> The U2 conversion code source code is not public so we can only guess. The
> method used by OpenQM was recently changed to correct problems with dates
> way back in history and is essentially as follows. It sounds complex but
it
> is mostly just a series of division operations.....
>
> 1.  Add 718430 to the day number. This gives a datum of 1 January 0001 to
> simplify things. (QM documents that it doesn't support BC dates and that
we
> don't allow for the calendar changes in 1752 or 1583 depending on where
you
> live).
>
> 2. Divide by 146097 to work out how many 400 year cycles we have
completed.
> This allows for the complications of leap year calculations.
>
> 3. Work out how many 100 year cycles we are into the remaining years from
> step 2.
>
> 4. Work out how many 4 year cycles we are into the remaining years from
step
> 3.
>
> 5. Calcualte whole years into the current 4 year cycle.
>
> 6. Decide if this is a leap year.
>
> 7. Work out the calendar date within the year.
>
> 8. Now that we know the day/month/year, apply the conversion code to
> construct the actual date string.
>
> Our date conversions also have codes for 1st, 2nd, 3rd,... style dates and
> for ISO week numbers. The ISO week calculation is even more horrific but
is
> well documented on the web
(http://personal.ecu.edu/mccartyr/ISOwdALG.txt).
>
>
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB
> +44-(0)1604-709200
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to