Re: Week of year - odd/even week
Re: Week of year - odd/even week
- Subject: Re: Week of year - odd/even week
- From: Michelle Steiner <email@hidden>
- Date: Thu, 31 Jan 2002 14:44:06 -0700
On 1/31/02 1:58 PM, martin schiller <email@hidden> wrote:
>
Can anyone help me with some pointers or a routine to determine the week
>
of the year? I'm trying to set a script to send me a reminder to put out
>
the yard waste container on alternate weeks.
Here ya go.
set startofyear to "jan 1"
set startofyear to date startofyear
if weekday of startofyear is not Sunday then
set startofyear to startofyear + (adjustDate(startofyear) * days)
end if
set today to current date
if (integer ((today - startofyear) / weeks)) mod 2 is 0 then
display dialog "Even week."
else
display dialog "Odd week."
end if
to adjustDate(x)
set weeksrtring to "SunMonTueWedThuFriSat"
set calcedday to text 1 through 3 of (weekday of x as string)
set dayposition to [opt-L]
(integer ((7 - (offset of calcedday in weeksrtring) / 3)))
return dayposition
end adjustDate
--Michelle
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------