set {y, m, d, w, h, min, sec} to my date2list((current date)) if h < 6 then display dialog "The date has been changed already." & return & "Do you want to overwrite the date as it is still on the previous date?" buttons {"No", "Yes"} default button 2 giving up after 15 if button returned of result is not equal to "No" then set {y, m, d, w, h, min, sec} to my date2list((current date) - h * hours - min * minutes - sec - 60) end if
set wkd to item w of {" (Sun)", " (Mon)", " (Tue)", " (Wed)", " (Thu)", " (Fri)", " (Sat)"} set sdate to "" & y & "-" & m & "-" & d & wkd
sdate
on date2list(aDate) if class of aDate = date then set theDate to aDate else set theDate to current date end if tell theDate to return {year, its month as number, day, its weekday as number, its hours, its minutes, its seconds} end date2list