Re: Week of year - odd/even week
Re: Week of year - odd/even week
- Subject: Re: Week of year - odd/even week
- From: Nigel Garvey <email@hidden>
- Date: Sun, 3 Feb 2002 00:15:24 +0000
Emmanuel wrote on Fri, 1 Feb 2002 18:24:54 +0100:
>
At 2:11 PM +0100 1/2/02, Nigel Garvey wrote:
>
>
>(If, like me, you think a week starts on a Sunday, change the date in the
>
>fourth line to 5th January 1000.)
>
>
Are you saying that Sunday is the first day of the week according to the
>
ISO standard?
Certainly not. The ISO didn't invent the calendar any more than the IEEE
invented arithmetic. I was merely providing a helpful aside for anyone
who might feel the need to modify my optimisation of your script.
By the way, my optimisation (like your "French Vanilla") fails with dates
earlier than 1904. This is because AppleScript doesn't currently conform
fully to the AS standard for date arithmetic. Trying to subtract one date
from another when they're both earlier than 1904 produces a "result too
large" error. Since neither "French Vanilla" nor "Week of Year" actually
needs the year number - just a year of the same pattern - the cure is to
transpose affected parameter dates by a convenient multiple of 400 years.
(Minimum 1200.)
if year of theDate comes before 1904 then
copy theDate to theDate
set year of theDate to (year of theDate) + 2000
end if
-- Rest of script ....
>
Someone on this list, if I remember correctly, knows the URL for the ISO
>
about times and dates. Is that you, NG?
I'm afraid not, but it shouldn't be difficult to find.
NG