• 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 16:26:16 +0100


On 8 Jul 2006, at 15:54, Michelle Steiner wrote:

This works:
set today to date "Tuesday, July 8, 2008 8:00:0 AM"
set time of today to (time of today) + anything

This doesn't:
set today to date "Tuesday, July 8, 2008 8:00:0 AM"
set time of today to (time of today) - something

if "something" causes "today" to be the previous day (or earlier). However, it works if it causes it to be earlier in the same day.

--> "Can't make some data into the expected type."

I guess that's because subtracting any value larger than a date's time results in a negative value - and you can't set a time to a negative value, Michelle. It's probably better to apply such adjustments to the date itself:


----------

set today to date "Tuesday, July 8, 2008 08:00:00"
set today to today - 9 * hours
--> date "Monday, July 7, 2008 23:00:00"

----------

(In this case, of course, the variable label 'today' is no longer particularly appropriate. ;-))

---
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>)

  • Prev by Date: Re: Intel gets bad height and width
  • Next by Date: Re: Date manipulation
  • Previous by thread: Date manipulation
  • Next by thread: Re: Date manipulation
  • Index(es):
    • Date
    • Thread