$datediff function

$datediff(date1,date2)

The $datediff function returns the difference, in days, between date1 and date2. Both dates must be in the standard internal format yyyymmdd: 4-digit year, 2-digit month, 2-digit day of the month.

Roughly speaking, this function returns date1 - date2, although the actual calculation involves more than a subtraction because of the date format. The result is negative if date1 < date2 (i.e., earlier) and positive if date1 > date2 (i.e., later).

Parameters

All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.

date1
First date in the format yyyymmdd.
date2
Second date in the format yyyymmdd.

Examples

Here are some usage examples for this function:

<$datediff(<InstallDate>, <BuildDate>)>

Returns the number of days (positive) between the date the installer was built and the current installation.

Note: BuildDate and InstallDate are standard variables. However, BuildDate is not saved in the installer's database by default, so you must set its Include in installer attribute to use it in the installer.

<$datediff(<InstallDate>, <BuildDate>)> > 180
This is a conditional expression that returns True if the current installation date is more than 180 days after the installer's build date. You can use this type of condition, for example, to alert the user to possible new software releases.