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

Re: Date manipulation


  • Subject: Re: Date manipulation
  • From: kai <email@hidden>
  • Date: Sat, 8 Jul 2006 17:57:21 +0100


On 8 Jul 2006, at 16:39, Michelle Steiner wrote:

On Jul 8, 2006, at 8:23 AM, Adam Bell wrote:

set today to date "Tuesday, July 8, 2008 8:00:00 AM"
set sub to 11
set time of today to (time of (today - 1 * days)) + (24 - sub) * hours
today

That sets the date to the future...

Right. The expression [(time of (today - 1 * days))], or [time of (today - days)], would return the same value as [time of today], so any value added to that would increment the time. Unless, that is, the value of 'sub' happens to be greater than the date's hours + 24 - in which case, the same coercion error would then result.


A date value's time property is an integer that specifies the number of seconds since midnight of the date in question. You can't set it to a negative value:
--------
set time of (get current date) to -1
--> error number -1700: "Can't make some data into the expected type."
--------


---
kai


_______________________________________________ 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
References: 
 >Date manipulation (From: Michelle Steiner <email@hidden>)
 >Re: Date manipulation (From: Adam Bell <email@hidden>)
 >Re: Date manipulation (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Code referenced by variable runs but variable undefined
  • Next by Date: Re: Date manipulation
  • Previous by thread: Re: Date manipulation
  • Next by thread: Re: Date manipulation
  • Index(es):
    • Date
    • Thread