• 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: Can't Coerce String to Date?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't Coerce String to Date?


  • Subject: Re: Can't Coerce String to Date?
  • From: Alex Hall <email@hidden>
  • Date: Fri, 13 Mar 2015 15:14:53 -0400


On Mar 13, 2015, at 2:09 PM, Yvan KOENIG <email@hidden> wrote:


Le 13/03/2015 à 16:37, Alex Hall <email@hidden> a écrit :

Now that my newest script uses NSDates, I'm trying to give those to this handler. Of course it won't work directly, so I need to put the NSDate into the AppleScript date type. I thought it would be easy:

set startDateString to (e's startDate()'s |description|()) as text
set startDate to (word 2 of startDateString & "/" & word 3 of startDateString & "/" & word 1 of startDateString) as date

In that snippet, "e" is an EKEvent. I don't get an error requesting e's date; rather I get an error that "can't convert "03/20/2015" to date". Yet, according to Google, AS can easily convert a string like that. The time will be midnight, but I can add the time in once this part is working. What am I doing wrong, or did something change because I'm using Yosemite and/or scripting additions?

--
Have a great day,
Alex Hall
email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can't Coerce String to Date?
      • From: Yvan KOENIG <email@hidden>
    • Re: Can't Coerce String to Date?
      • From: "Stockly, Ed" <email@hidden>
References: 
 >Can't Coerce String to Date? (From: Alex Hall <email@hidden>)
 >Re: Can't Coerce String to Date? (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: What Does Error Return ?
  • Next by Date: Re: Can't Coerce String to Date?
  • Previous by thread: Re: Can't Coerce String to Date?
  • Next by thread: Re: Can't Coerce String to Date?
  • Index(es):
    • Date
    • Thread