How do I set podcast release date in iTunes using Applescript?

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?


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