// Month and day "the «DateVar:Third day of June» " // Thousands SET Temp-n TO TRUNCATE( YEAR OF( DateVar ) / 1000 , 0 ) * 1000 RESULT + "in the year of our Lord, this «Temp-n:Ninth»" // Hundreds SET Temp-n TO YEAR OF( DateVar ) - Temp-n IF Temp-n > 99 RESULT + "«TRUNCATE( Temp-n / 100, 0 ) * 100:Nine»" END IF // Tens and ones SET Temp-n TO Temp-n - TRUNCATE( Temp-n / 100, 0 ) * 100 IF Temp-n > 0 RESULT + " and «Temp-n:Ninth»" END IF
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. Much less does HotDocs provide a date format that includes in the year of our Lord, a necessary construction in some locales. 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").
We first take the month and day values formatted as needed, then include the text "in the year of our Lord, this".
The year must be taken in segments, as the thousands and ones values need to be fomatted differently than the hundreds and tens. To isolate just the thousands, we divide the year by 1000 and trim off everything after the decimal point, then multiply by 1000. For example: 1999 / 1000 = 1.999; 1 * 1000 = 1000. To eliminate the thousands position from the year, we can subtract the truncated value from the original value: 1999 - 1000 = 999. This same technique is used to isolate and format the hundreds, tens and ones.
This template has everything you need set up and configured for you. It will work as-is, or can be adapted to your variable and dialog names. It contains: 1) sample Word and WordPerfect templates (or an Automator form) to demonstrate an implementation of the computation, 2) a component file containing the computation and all supporting dialogs and variables, and 3) instructions for adapting the computation for your use.