Offset Expressions in Macros
The date/time macros (yyyy, mm, etc.) have been extended by defining "offset expressions" that may be tacked onto the macro name to compute an offset from today's date.
NOTE: Offset expressions are available for file naming only; they are not available for distributions, etc.
The syntax is as follows:
&[macro{.sign{count}units}]
-
The braces ({ }) enclose optional portions of the syntax.
-
macro is a macro name (e.g., yyyy).
-
sign is + (plus) to add to the current date or - (minus) to subtract from the current date.
-
count is an optional integer count.
-
units specifies the units to be added or subtracted: d for days, m for months or y for years.
NOTE: The offset expression, if present, must be separated from the macro name by a period (.).
Syntax for Offset Expressions
The following table provides examples of syntax for offset expressions:
Example |
Meaning |
&[dd.+1d] |
The day portion of tomorrow's date. |
&[dd.+d] |
Synonymous with &[dd.+1d]. The count defaults to 1. |
&[mm.+1d] |
The month portion of tomorrow's date. |
&[yyyy.+1d] |
The 4-digit year portion of tomorrow's date. |
&[dd.-1d] |
The day portion of yesterday's date |
&[mm.+7d] |
The month portion of the date one week from today |
&[mm.+1m] |
The month portion of the date one month from today. |
&[yyyy.+1y] |
The year portion of the date one year from today. |
&[yyyy.+2m+15d] |
The year portion of the date 2 months plus 15 days from today. More than one offset expression may be concatenated as shown to affect sums of different units. |
NOTE: The offset expression may be used with any of the date/time macros, including the time macros (hh, mi, and ss), although they have no effect on the latter, since &[hh.+1d] would give the same result as &[hh]. Likewise, one may make a macro like &[mm.+4y], but it is equivalent to &[mm] because adding or subtracting an integral number of years to a date can never affect the month.
(c) 2023 Altair Engineering Inc. All Rights Reserved.