ScanDateTime function
Scans a string for a TDateTime pattern and returns the date/time.
Declaration
function ScanDateTime(const Pattern: string; const s: string;
const fmt: TFormatSettings; startpos: Integer=1)
: TDateTime; overloadDescription
ScanDateTime scans string
S for the date/time pattern
Pattern, starting at position
StartPos (default 1).
Optionally, the format settings
fmt can be specified.
In effect, this function does the opposite of what FormatDateTime does. The Pattern variable must contain a
valid date/time pattern: note that not all possible formatdatetime patterns
can be recognized, e.g., hn cannot be detected properly.
- There is a special placeholder: a '?' will match any character in the input string.
- Note that the / and : character will be replaced by the actual date and time separator.
- Similarly, the 'am/pm' and 'a/p' will be replaced with the actual AM/PM indicators.
- a TAB character (ASCII Code 9) will match any whitespace block
Errors
In case of an error, a EConvertError exception is raised.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
