Mitech Preloader

FormatDate and IncrementDate

User Reference

FormatDate and IncrementDate

Dates can be formatted according to patterns defined in the fillpoints.


Command structure:

«FormatDate(Date_of_Signature,"MMM d yyyy")»
«FormatDate(Date_of_Dismissal,"d MMMM, yyyy")»

«FormatDate(Date_of_Signature,"MMMM o yyyy")»
«FormatDate(Date_of_Signature,"dddd MMMM o yyyy")»


These examples would result in something like, respectively:

Feb 7 2019
7 February, 2019
February 7th 2019
Thursday February 7th 2019

The results are in English, not because the default language is English, but because the default is either the Word version’s language or else the language chosen by the user in the XpressDox Settings.

The date can be output in other languages because XpressDox supports the use of any ISO 639-1 language code in the FormatDate function. These codes are defined in the second column in ISO 639-1.


Superscript the ordinal suffix:

If you need the ‘th’ in the date February 29th 2008 to be superscripted in the final result, then another technique would be used:
«FormatDate(SignatureDate,"MMMM d")»«OrdinalSuffix(FormatDate(SignatureDate,"d"))» «FormatDate(SignatureDate,"yyyy")»
where the «OrdinalSuffix(...)» is superscripted in the template.


Output the date in upper case:

«ToUpper(Today(‘MMMM d yyyy’))»
«ToUpper(FormatDate(MeetingDate,‘MMMM d yyyy’))»



Increment a date by a certain number of days, months or years.


Command structure:

«IncrementDate(DateOfBirth,25, "y")»

The above will add 25 years to the value in the data element ‘DateOfBirth’.


Further examples:

Tomorrow: «IncrementDate(Today(),1,"d")» i.e. add 1 day to today’s date.

Yesterday: «IncrementDate(Today(),-1,"d")» i.e. subtract 1 day from today’s date.


Formatting the incremented dates:

Yesterday’s date: «FormatDate(IncrementDate(Today(),-1,’d’),’MMMMM d yyyy’)»

About six months ago (on «FormatDate(IncrementDate(Today(),-6, "m"),"d MMMM yyyy")») the weather was completely different.


Working Days

With Version 5 of XpressDox a new “units” specifier was added: “w”, meaning “working days”. Not to be confused with “weeks”.

Saturdays and Sundays are always considered non-working days. For example, if two working days are added to a date which is a Friday, then the result is the following Tuesday.

Extra non-working days can be added either by specifying them in the function call itself, or by configuring them in the “Other Settings” tab of the XpressDox configuration. For example:

The court appearance will be in 10 court days from now, i.e. «FormatDate(IncrementDate(Today(),10,'w','2013-01-01,2013-05-01,2013-12-25'),'MMMM d, yyyy')».

If the non-working days are omitted from the function call («FormatDate(IncrementDate(Today(),10,'w'),'MMMM d, yyyy')») then the non-working days are taken from the XpressDox configuration, if they have been specified and apply to the template being executed. In any case, Saturdays and Sundays are always regarded as non-working days.

The non-working day dates provided in the function call do not need to be hard-coded. For example, if there is another system available at the site where the template is run and this system maintains a reliable list of non-working days, and this system is accessible via COM or .NET, then using the XpressDox Interact with External Programs capability, the following would be possible:

The court appearance will be in 10 court days from now, i.e. «FormatDate(IncrementDate(Today(),10,'w',GetObjectValue('o2Smart.Accounting:Settings.GetPublicHolidays')),'MMMM d, yyyy')».