I would like to add the release date to podcasts that I've imported into iTunes, but my applescript is returning an error about the date object.

    tell application "iTunes"
    set theSelection to selection
    if theSelection is not {} and (length of theSelection) is 1 then
        set theTrack to item 1 of theSelection
        log release date of theTrack as text
        set release date of theTrack to date ("2011-12-23T08:00:00Z" as string)

        refresh theTrack
    end if
end tell

The line set release date of theTrack to date ("2011-12-23T08:00:00Z" as string) gives me this error

error "Invalid date and time date 2011-12-23T08:00:00Z." number -30720

How do I make the string 2011-12-23T08:00:00Z into a date object that applescript won't complain about?

  • Ok the property is read-only, so I'll have to use something like Subler.
    – joshu
    Feb 16, 2012 at 14:29

3 Answers 3


Unfortunately, it is not possible to change the "release date" tag within iTunes using Applescript because the property is read-only.


The documentation may say that it's read-only (and it does say that), but I have observed that if I have a date value, it totally still works:

tell application "iTunes"
    repeat with theTrack in selection
        set theDate to date("11/1/2003")
        set release date of theTrack to theDate
    end repeat
end tell

The string-to-date conversion depends on your locale settings (section "Formats" of "Language & Text" Preference pane in Snow Leopard), and you can also examine the format by executing the output of AppleScript command current date.

However, there's a way of making date initialization in AppleScript locale-independent (and thus portable):

set d to current date -- initialize new date object
set {year of d, month of d, day of d, time of d} to {2011, 12, 23, 8 * hours + 13 * minutes + 39} -- the last number is seconds
-- d is now set to 2011/12/23 08:13:39
  • by the way: if you want to always supply the date as text in a specific format, you could use a parser such as this one: gist.github.com/1852783
    – fanaugen
    Feb 17, 2012 at 11:24
  • thanks, but I won't be able to use applescript after all. Please see my answer.
    – joshu
    Feb 18, 2012 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .