Applescript date format

Discussion in 'Mac Programming' started by tfindlay, May 15, 2008.

  1. tfindlay macrumors newbie

    May 15, 2008
    The following works to create a new event for today but what do I use in place of "set theDate to current date" if I want to use a specific start date (such as May 27, 2008) rather than the current date?

    tell application "iCal"
    tell calendar "My Calendar"
    set theDate to current date
    make new event at end with properties {description:"Event Description",
    summary:"Event Name", location:"Event Location", start date:theDate,
    allday event:true}
    end tell
    end tell
  2. MyndCraft macrumors newbie

    Feb 14, 2003
    You would do this…

    set theDate to date "5/27/08"
    When you compile the script the though it will expand theDate to the full format - date "Tuesday, May 27, 2008 12:00:00 AM"

    If you don't want the values to expand until run time you would do it like this…

    set theDate to "5/27/08"
    set theDate to date theDate

Share This Page