How do I save a screenshot with the ISO 8601 date format with Applescript? I am building a script that saves many consecutive screenshots. I would like to save the files in the ISO 8601 date format.
To get the date in ISO 8601 format, use:

on date_to_iso(dt)
    set {year:y, month:m, day:d} to dt
    set y to text 2 through -1 of ((y + 10000) as text)
    set m to text 2 through -1 of ((m + 100) as text)
    set d to text 2 through -1 of ((d + 100) as text)
    return y &amp; "-" &amp; m &amp; "-" &amp; d
end date_to_iso

on date_time_to_iso(dt)
    set {year:y, month:m, day:d, hours:h, minutes:min, seconds:s} to dt
    set y to text 2 through -1 of ((y + 10000) as text)
    set m to text 2 through -1 of ((m + 100) as text)
    set d to text 2 through -1 of ((d + 100) as text)
    set h to text 2 through -1 of ((h + 100) as text)
    set min to text 2 through -1 of ((min + 100) as text)
    set s to text 2 through -1 of ((s + 100) as text)
    return y &amp; "-" &amp; m &amp; "-" &amp; d &amp; "T" &amp; h &amp; ":" &amp; min &amp; ":" &amp; s
end date_time_to_iso


You can call these with, for example:

set dt to current date
date_to_iso(dt)


gives something like "2013-10-23"

set dt to current date
date_time_to_iso(dt)


gives something like "2013-10-23T14:00:05"

Source: AppleScript Date to ISO Format