Set a local variable to a date value.
This instruction is used by the TapeTrack INI Engine.
SetVar2Date(varname, date, value);
| Variable | Type | Description | Min Length | Max Length |
|---|---|---|---|---|
| varname | String | Name of the local variable | 1 | 16 |
| date | String | The date, required in one of the formats in the table below | 1 | 64 |
| value | String | The date value in strfdate(3) format | 1 | 64 |
| Date Variable Formats | Description |
|---|---|
| *[+|-]n | Today's date plus or minus an optional number of days. |
| * | Today. |
| *-100 | 100days ago. |
| *+30 | 30 days into the future. |
| YYYY-MM-DD | The date in ISO date format. |
| 2010-12-31 | The 31st of December 2010. |
| Y|y[+|-]n[+|-]m[+|-]d | The beginning or end of the year, + or - a number of years, + or - a number of months, + or - a number of days. |
| Y-0 | The start of the current year. |
| y-0 | The end of the current year. |
| Y-1 | The start of last year. |
| Y-1+3+3 | The 3rd day of the third month of last year. |
| Y+10+3+3 | The 3rd day of the 3rd month of the year 10 years from now. |
| M|m[+|-]m[+|-]d | The beginning or end of the month, + or - a number of months, + or - a number of days. |
| M-0 | The start of the current month. |
| m-0 | The end of the of the current month. |
| M-1 | The start of last month. |
| M-1+3 | The 3rd day of last month. |
Set variable YESTERDAY to yesterday's date.
SetVar2Date(YESTERDAY, "*-1", "%%Y-%%m-%%d");
WriteMsg("Yesterday was %YESTERDAY");
Set variable START to the first day of this year and END to the last.
SetVar2Date(START, "Y-0", "%%Y-%%m-%%d");
SetVar2Date(END, "y-0", "%%Y-%%m-%%d");
WriteMsg("Date range is $START through $END");