Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

IncrementDate – XpressDox

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’.


Some simple 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')».


Further examples:

Example 1:
«Today('D MMMM, yyyy')» incremented «Time_period»
«if(Time_period = 'Weekly')»
«FormatDate(IncrementDate(Today(),7,'d'),'d MMMM, yyyy')»
«FormatDate(IncrementDate(Today(),1,'m'),'d MMMM, yyyy')»


Example 2:
Beginning date of hearing: «FormatDate(Hearing_Date,'d MMMM yyyy')»
Length of hearing (working days): «No_of_days»
Calculated end date: «FormatDate(IncrementDate(Hearing_Date,No_of_days,'w'),’d MMMM yyyy’)»


Example 3:
Rental contract:
Effective date of contract: «FormatDate(Effective_date,'d MMMM, yyyy')»
Period in months: «Period»
Rental commences on: «SetVr('rentStart',IncrementDate(Effective_date,Period,'m'))»
«FormatDate(GetV('rentStart'),'d MMMM, yyyy')»
Two weeks after rent becomes effective: 
«FormatDate(IncrementDate(GetV('rentStart'),14,'d'),'d MMMM, yyyy')»
Day before rental is due landlord should inspect property:
«FormatDate(IncrementDate(GetV('rentStart'),-1,'d'),'D MMMM, yyyy')»


Related articles: