• 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: Data arithmetic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Data arithmetic


  • Subject: Re: Data arithmetic
  • From: Andrew Oliver <email@hidden>
  • Date: Wed, 09 Mar 2005 18:09:13 -0800

On 3/9/05 5:52 PM, "Michelle Steiner" <email@hidden> wrote:

> set a to "March 9, 1961"
> set b to "june 1, 1983"
> set c to "May 31, 1983"
> log (date b) + ((date b) - (date a))
> log (date c) + ((date c) - (date a))
>
> (*Tuesday, August 23, 2005 12:00:00 AM*)
> (*Sunday, August 21, 2005 12:00:00 AM*)
>
> Shouldn't the results be only one day apart, not two days?

Not at all. Consider the results if using integers rather than dates

 set a to 3
 set b to 10
 set c to 9 -- or b - 1

 b + (b - a) --> 10 + (10 - 3 ) --> 10 + 7 --> 17
 c + (c -a) --> 9 + (9 - 3) --> 9 + 6 --> 15

Or reading it another way, c = b -1, so you have;

 b + b - a
 (b - 1) + (b - 1) + a

The latter will always be two less than the first.

Andrew
:)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Data arithmetic
      • From: "Michelle Steiner" <email@hidden>
References: 
 >Data arithmetic (From: "Michelle Steiner" <email@hidden>)

  • Prev by Date: Data arithmetic
  • Next by Date: Re: save story in Quark6 seems flaky
  • Previous by thread: Data arithmetic
  • Next by thread: Re: Data arithmetic
  • Index(es):
    • Date
    • Thread