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

Re: Date computation


  • Subject: Re: Date computation
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 7 Jan 2005 13:01:16 -0700

On Jan 7, 2005, at 12:45 PM, Paul Berkowitz wrote:

The difference, expressed in what units?  And I still don't see where
the most recent Wednesday is achieved here.

'modulated', i.e. mod, gets you the remainder after whole number division.

Yeah, that much I knew.

It doesn't matter how many weeks have passed since that "known Wednesday" in
1900 - dividing (the number of seconds resulting from subtracting that
Wednesday date from any other date) by 'weeks' (i.e. 7 * 24 * 60 * 60
seconds) will be the mod remainder: the number of seconds since the most
recent Wednesday midnight.

That part is not getting through. "b" is the 14th of the month, and we're subtracting a known Wednesday (BTW, we could just as easily use Dec 31, 2003, the most recent Wednesday known to be in the past), so where do we get the most recent Wednesday from?


tell b to set {day, day} to {32, 14}

And I certainly don't understand that.


That looks like a typical Nigel trick. I think that if you try to set the
day of any date to 32 AppleScript gives you the 1st of the succeeding month
- it saves a LOT of computation.

Now, *that* did get through. It's brilliant, even if obscure and esoteric. Thanks.


However, it sets it to the first only if the current month has 31 days; it sets it to the 2nd from a 30-day month; to the third from Feb in a leap year, and to 4 in all other Febs. But those differences won't make a difference, because the goal is to set the month to the next month; the day doesn't matter, because it's going to be set to 14 right afterwards.

-- Michelle

--
Don't anthropomorphize computers.  They hate that.

_______________________________________________
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: Date computation
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: Date computation (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Date computation
  • Next by Date: Re: Date computation
  • Previous by thread: Re: Date computation
  • Next by thread: Re: Date computation
  • Index(es):
    • Date
    • Thread