103. Include "and" in the Year
Description
Spell out a date in the format "Third day of June, One Thousand Nine Hundred and Ninety".
Code
// Month and day
"«DateVar:Third day of June», "
// Year
SET Temp-n TO TRUNCATE( YEAR OF( DateVar ) / 100 , 0 ) * 100
RESULT + "«Temp-n:Nine»"
SET Temp-n TO YEAR OF( DateVar ) - Temp-n
IF Temp-n > 0
RESULT + " and «Temp-n:Nine»"
END IF
Explanation
HotDocs does not provide a date format that includes and in the year, nor is it possible to create a custom format that includes and. This computation provides a way of doing it.
The computation only uses two variables, DateVar, the date variable you wish to format, and Temp-n, a temporary number variable (set its Advanced options to "Ask only in dialog," "Don't warn if unanswered," and "Don't save in answer file").
To insert the word and inside of the year, we first take only the thousands and hundreds values of the year and format them, then we insert our and and finally add on the tens and ones values of the year.