更新时间:2023-09-15 20:18:40
Zero的stringForDate处理程序稍微优化版
A slightly optimized version of Zero's stringForDate handler
on stringForDate(aDate)
if aDate is "" then set aDate to (the current date)
if class of aDate is not date then return null
set {year:dYear, month:dMonth, day:dDay} to aDate
set dMonth to dMonth as integer
if dMonth < 10 then set dMonth to "0" & dMonth
if dDay < 10 then set dDay to "0" & dDay
return ((dYear & "-" & dMonth & "-" & dDay) as string)
end stringForDate