Hello.
The heading says it all, and these are made due to Nigel Garvey.
These functions makes setting dates in scripts shareable by whatever localization others are using - and working wherever they are run or compiled.
One shouldn’t use these handlers before Friday, 15 October 1582 due to the fact that Apple Script does switch to the Julian Calendar which preceded the Gregorian which were initiated at Friday 15th of October 1582. The fact that AppleScript does that renders the algorithms not usable before that date, since there is 10 days amiss and the calculations before that date differs slightly.
There is a very interesting article about the calendar reform at WikipediA
-- setDate(1904,1,1,(current date ))
on setDate(intYear, intMonth, intDay, dateObject) -- thanks to Nigel Garvey
tell dateObject
set {day, year, its month, day} to {1, intYear, intMonth, intDay}
end tell
return dateObject
end setDate
on setTimeOfTheDay(int23Hour, int59Minuts, int59Seconds, dateObject) -- fixed by Nigel Garvey
set time of dateObject to int23Hour * hours + int59Minuts * minutes + int59Seconds
return dateObject
end setTimeOfTheDay
on setDateAndTime(intYear, intMonth, intDay, int23Hour, int59Minutes, int59Seconds) -- fixed by Nigel Garvey
tell (current date)
set {day, year, its month, day, time} to {1, intYear, intMonth, intDay, int23Hour * hours + int59Minutes * minutes + int59Seconds}
return it
end tell
end setDateAndTime