• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Week of year - odd/even week
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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. |
----------------------------------------------------------------------


  • Prev by Date: RE: Unique ID (Chris Wood)
  • Next by Date: Help with moving the trash
  • Previous by thread: Re: Week of year - odd/even week
  • Next by thread: Re: Week of year - odd/even week
  • Index(es):
    • Date
    • Thread