• 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: Emmanuel <email@hidden>
  • Date: Fri, 1 Feb 2002 00:05:52 +0100

At 9:58 PM +0100 31/1/02, martin schiller 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.

Solutions have been provided which may or may not be correct.

The index of the week is:

------------------------------
1 + ((theDate - theFirst) div (7 * 86400))
------------------------------

theFirst being, not the first day of the year, but the first day of ... the
first week of the year!

Below I give the script to compute the first day of the first week of the
year which contains theDate.

------------------------------ tested (was included in Smile's distribution)
copy theDate to theFirst
set day of theFirst to 1
set month of theFirst to January
set time of theFirst to 0
repeat until (weekday of theFirst) is Thursday
set day of theFirst to 1 + (get day of theFirst)
end repeat
repeat until (weekday of theFirst) is Monday
set day of theFirst to 1 + (get day of theFirst)
end repeat
set theFirst to theFirst - 7 * 86400
------------------------------

HTH
Emmanuel


  • Prev by Date: Re: Need help with some functions of scripting
  • Next by Date: Re: Unique ID
  • Previous by thread: Re: Week of year - odd/even week
  • Next by thread: Re: Week of year - odd/even week
  • Index(es):
    • Date
    • Thread