• 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
Date Variables that modify themselves! Huh?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Date Variables that modify themselves! Huh?


  • Subject: Date Variables that modify themselves! Huh?
  • From: Guy Parker <email@hidden>
  • Date: Wed, 04 Jul 2001 14:17:09 +0100

This seems like weird behaviour to me but maybe I'm being dumb! Any ideas?

In the example as written below the action of modifying one variable
(DateTimeSend) affects another variable (DateTimeNow) from which the first
was derived. If the line containing "--this fails" is replaced by the one
containing "--this works" then the action of modifying one variable does not
affect the other.

How is it that modifying one variable affects another from which it was
originally derived? Maybe it is a date related issue but it seems strange to
me!

I would prefer to use just one instance of "current date" since there is a
(small) risk that more than just the time could be different if it is used
twice.

Thanks,

Guy

tell application "Finder"
set DateTimeNow to (current date)
set DateTimeSend to DateTimeNow --this fails
--set DateTimeSend to (current date) --this works

set DelayTime to 10800 --set time to 3am

display dialog "These should both be identical:
" & (DateTimeNow as text) & "
" & (DateTimeSend as text)

set time of DateTimeSend to DelayTime

display dialog "These should both be different:
" & (DateTimeNow as text) & "
" & (DateTimeSend as text)

end tell


  • Follow-Ups:
    • Re: Date Variables that modify themselves! Huh?
      • From: John W Baxter <email@hidden>
    • Re: Date Variables that modify themselves! Huh?
      • From: "Serge Belleudy-d'Espinose" <email@hidden>
    • Re: Date Variables that modify themselves! Huh?
      • From: Greg Strange <email@hidden>
  • Prev by Date: Date Variables that modify themselves! Huh?
  • Next by Date: Re: Date Variables that modify themselves! Huh?
  • Previous by thread: Date Variables that modify themselves! Huh?
  • Next by thread: Re: Date Variables that modify themselves! Huh?
  • Index(es):
    • Date
    • Thread