$datenow function

$datenow(days,months,years)

The $datenow function returns the date that is days, months, years after the current date (or before, if any of them are negative). The date is returned in the standard internal format yyyymmdd: 4-digit year, 2-digit month, 2-digit day of the month.

The days, months, years parameters are optional; you may leave them empty if you don't need them. However, you must insert commas as necessary to indicate which of the three fields you are using. Some examples:

Tip: To add or subtract days, months, or years from an arbitrary date, you can use the $dateadd function.

Note: The current date is returned as the date in the local timezone. This may cause small differences if you compare it with dates such as BuildDate that may have been set in a different timezone.

Parameters

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

days
Difference in days, either positive (for a later date) or negative (for an earlier date). This parameter is optional.
months
Difference in months, either positive (for a later date) or negative (for an earlier date). This parameter is optional.
years
Difference in years, either positive (for a later date) or negative (for an earlier date). This parameter is optional.

Examples

Here are some usage examples for this function:

<$datenow()>
Returns today's date.
<$datenow(30)>
Returns the date 30 days after today.
<$datenow(,-6)>
Returns the date 6 months before today's date.
<$datenow(-180)> > <BuildDate>

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.

Note: BuildDate is a standard variable. However, it 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.