MACSCRPT Archives

May 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nigel Garvey <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sun, 21 May 2006 13:10:42 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (32 lines)
Paul Berkowitz wrote on Fri, 19 May 2006 20:33:02 -0700:

>    set d to (current date)
>    set month of d to February
>    set day of d to 6
>    set year of d to 2007
>    set time of d to (10 * hours)
>
>That will work no matter what international date and time formats the user
>machine uses.

Because of the "overflow" phenomenon when one date property is too large
for another, if the current date happens to be the 31st of the month, the
above script will create a date in March. The best solution seems to be
to set the day to a number below 29 first (to avoid the overflow), then
set the year and the month (to establish any leap year conditions), and
finally set the day and the time.

  set d to (current date)
  set day of d to 1
  set year of d to 2007
  set month of d to February
  set day of d to 6
  set time of d to (10 * hours)

Or, as kai might have it:

  tell (current date) to set {day, year, its month, day, time, d} to {1,
2007, February, 6, 10 * hours, it}

NG

ATOM RSS1 RSS2