Accepts a calendar date. Spaces are stripped from the input before parsing. Formats are tried in the order described below.
Compact (no separators)
| Length | Format | Example (day-first locale) | Example (month-first locale) |
|---|---|---|---|
| 4 digits | ddmm / mmdd |
2503 → 25 Mar |
0325 → 25 Mar |
| 8 digits | ddmmyyyy / mmddyyyy |
25032026 → 25 Mar 2026 |
03252026 → 25 Mar 2026 |
The 4-digit compact format assumes the current year.
ISO (separator-based, year first)
Any of yyyy/mm/dd, yyyy-mm-dd, or
yyyy.mm.dd. Recognized whenever the first four characters
are digits followed by /, -, or
..
2026-03-25 2026/03/25 2026.03.25
Locale fallback
When neither compact nor ISO format matches,
TryStrToDate is tried against the runtime locale format.
The separators /, -, and . are
all accepted and normalized to the runtime DateSeparator
before parsing. This covers formats such as dd/mm/yyyy,
mm/dd/yyyy, and 2-digit year forms like
26/03/25.
Two-digit year resolution follows
SysUtils.TwoDigitYearCenturyWindow (default 50). A 2-digit
year is mapped to the century that keeps the result within that window
of the current year. Applications that require deterministic behavior
should set TwoDigitYearCenturyWindow explicitly at
startup.
The locale-aware date string produced by DateToStr.
The SQL date literal depends on the dialect. See SQL dialects for the full format table.
2026-03-25 →
sqlElevateDB, sqlMySQL,
sqlPostgreSQL, sqlFirebird: DATE '2026-03-25'
sqlDBISAM, sqlMSSQLServer,
sqlSQLite: '2026-03-25'
sqlOracle: TO_DATE('2026-03-25','YYYY-MM-DD')
sqlAccess: #2026-03-25#
sqlBDEParadox: "25.03.2026"
Input: 01/01/2026~31/12/2026
→ otRange
→ BETWEEN DATE '2026-01-01' AND DATE '2026-12-31' (sqlElevateDB)
The left date must not be later than the right date; otherwise
ERR_INVALID_RANGE is returned.