Re: date arithmetic weirdness
Re: date arithmetic weirdness
- Subject: Re: date arithmetic weirdness
- From: John W Baxter <email@hidden>
- Date: Sun, 31 Mar 2002 20:08:52 -0800
At 19:44 -0700 3/31/2002, Michelle Steiner wrote:
>
When I try to run this script:
>
>
set a to "nov 3, 1997"
>
set b to "oct 9, 1997"
>
set c to "dec 1, 2002"
>
>
set foo to (date a) - (date b) --this line errors
>
set bar to (date c) - foo
>
>
I get this error
>
>
--> "Can't make date Thursday, October 9, 1997 12:00:00 AM" into a
>
number or date.
>
>
But if I substitute the literal "oct 9, 1997" for b in that line, the
>
script executes without problem.
As Paul said, throw in a few gets. A working verbose form is
set a to "nov 3, 1997"
set b to "oct 9, 1997"
set c to "dec 1, 2002"
set a to date (get a)
set b to date (get b)
set c to date (get c)
set foo to a - b --this line errors
set bar to c - foo
bar
--> date "Wednesday, November 6, 2002 0:00:00"
(which "feels like" the right answer).
It should be possible to get rid of the second 3 set commands.
--John
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.