• 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: Conversion of ISO Date String to AppleScript Date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conversion of ISO Date String to AppleScript Date


  • Subject: Re: Conversion of ISO Date String to AppleScript Date
  • From: Ed Stockly <email@hidden>
  • Date: Sat, 04 Mar 2017 21:02:10 -0800

OK this works, even if you run it on New Years Eve (But I have much less faith in it. Since we generally get the day off on New Years Eve, I guessing that’s why that earlier version has never been a problem. Any other dates I should worry about?)

----------------------------

set ISOdateString to "2017-04-04 11:15:15"
set appleScriptDate to my AppleScriptISODate(ISOdateString)
return appleScriptDate

on AppleScriptISODate(ISOdateString)
	set {theYear, theMonth, theDay, theHour, theMin, theSec} to words of ISOdateString
	set myDate to date "Saturday, January 1, 2000 at 12:00:00 AM"
	set {year of myDate, month of myDate, day of myDate, hours of myDate, minutes of myDate, seconds of myDate} to {theYear as integer, theMonth as integer, theDay as integer, theHour as integer, theMin as integer, theSec as integer}
	return myDate
end AppleScriptISODate

--date "Saturday, April 4, 2017 at 11:15:15 AM"
 _______________________________________________
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: Conversion of ISO Date String to AppleScript Date
      • From: Ed Stockly <email@hidden>
References: 
 >Re: Conversion of ISO Date String to AppleScript Date (From: Ed Stockly <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Ed Stockly <email@hidden>)

  • Prev by Date: Re: Conversion of ISO Date String to AppleScript Date
  • Next by Date: Re: Conversion of ISO Date String to AppleScript Date
  • Previous by thread: Re: Conversion of ISO Date String to AppleScript Date
  • Next by thread: Re: Conversion of ISO Date String to AppleScript Date
  • Index(es):
    • Date
    • Thread