Type: TInputType |
Unit: EgStrParser
Accepts a calendar date. Spaces are removed before parsing. The formats are tried in the order below.
Compact (no separators, decimal digits only)
| Length | Format | Day-first locale | Month-first locale |
|---|---|---|---|
| 4 digits | ddmm / mmdd |
2503 -> 25 March |
0325 -> 25 March |
| 8 digits | ddmmyyyy / mmddyyyy |
25032026 -> 25 March 2026 |
03252026 -> 25 March 2026 |
The 4-digit form takes the current year.
ISO (year first)
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
When neither the compact nor the ISO form matches,
TryStrToDate is tried with the runtime locale format. The
separators /, - and . are all
accepted and replaced by the locale DateSeparator before
parsing. This covers forms such as dd/mm/yyyy,
mm/dd/yyyy and 2-digit years such as
26/03/25.
A 2-digit year follows TwoDigitYearCenturyWindow
(default 50): it is mapped to the century that keeps the date within
that window of the current year. Applications that need a fixed result
should set FormatSettings.TwoDigitYearCenturyWindow at
startup.
Anything else gives ERR_INVALID_FORMAT.
The locale date string produced by DateToStr.
The SQL literal depends on the dialect (see SQL dialects):
2026-03-25 ->
sqlElevateDB, sqlMySQL,
sqlPostgreSQL, sqlFirebird: DATE '2026-03-25'
sqlDBISAM, sqlSQLite: '2026-03-25'
sqlMSSQLServer: '20260325'
sqlOracle: TO_DATE('2026-03-25','YYYY-MM-DD')
sqlAccess: #2026-03-25#
sqlBDEParadox: "25.03.2026"
Input: 2026-01-01~2026-12-31
-> 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.