This plugin’s internal functions and commands can accept dates in any of these formats:
infmt | Format | Example | Would Be Interpreted As |
0 | (according to system locale) | 01/02/03 | varies; January 2, 2003 in the U.S. |
04/05 | varies; | ||
1 | mm/dd/yy or mm/dd/yyyy | 01/02/03 | January 2, 2003 |
mm/dd | 04/05 | ||
2 | dd/mm/yy or dd/mm/yyyy | 01/02/03 | February 1, 2003 |
dd/mm | 04/05 | ||
3 or 4 | yy/mm/dd or yyyy/mm/dd | 01/02/03 | February 3, 2001 |
mm/dd | 04/05 | ||
- | ISO 8601 format | 1941-12-07 | December 7, 1941 |
- | ISO 8601 week-day format | 1969-W29-7 | July 20, 1969 |
- | ISO 8601 ordinal format | 1863-323 | November 19, 1863 |
- | ISO 8601, packed | 19120623 | June 23, 1912 |
- | days since 1970-01-01 | U+2701 | May 25, 1977 |
- | MS-DOS day number | +3333 | February 15, 1989 |
- | T format (offset from today’s date) | T+21 | |
- | ANSI day number | A+78169 | January 8, 1815 |
For compatibility with long-standing 4DOS/4NT/Take Command behavior, dates may be entered in local formats using two-digit years. Years 80 to 99 are interpreted as 1980 through 1999; 00 to 79 are interpreted as 2000 through 2079. Although two-digit years are legal and documented, I strongly recommend passing only four-digit years to avoid confusion. If you omit the year, the plugin will assume the current year.
You can use the LONGYEARS
command
to require four-digit years in input dates. When LONGYEARS
is set to STRICT
, dates entered using two-digit years (e.g.
08/12/81) or without a year (e.g. 05/23) are illegal and will
raise an error.
Dates entered as mm/dd/yy, mm/dd/yyyy, dd/mm/yy, dd/mm/yyyy, yy/mm/dd, mm/dd, or dd/mm are all ambiguous: the parser cannot know for certain which format was intended. You can use an infmt parameter to tell the parser how to interpret them. If no infmt is present, they will be interpreted according to your system’s locale settings.
Dates in any of the ISO formats must be specified using four-digit years. Two-digit years in ISO date formats will raise an error. The ISO date formats are unambiguous; the parser can automatically determine the intended format, and any infmt parameter will be ignored.
The local date formats (0-3) will accept the slash, minus sign, or
period as a date separator. The ISO date formats require a minus sign.
MS-DOS day numbers may be positive or negative (or zero); they may have a leading
plus or minus sign. T-format dates may also be positive or negative; they
may start with either T+
or T-
. A lone
T
with no offset is also valid, and refers to today’s
date. You may also spell out TODAY
in full, e.g.
TODAY-1
for yesterday’s date.
MS-DOS day numbers are based on January 1, 1980 as day 0; dates before 1980 will have negative MS-DOS day numbers. ANSI day numbers use January 1, 1601 as day 1.