DateTime.TryParse

Syntax

TryParse(Value: String; Var Result: DateTime): Boolean;

Parameters

Value. The string that should be converted to the DateTime type.

Result. The date converted from the string.

Description

The TryParse method converts a string into the DateTime type with validation.

Comments

Available values:

The specified value must correspond to the available range that is set for the DateTime data type. If the date that is less than the available one is specified, the date, to which the current century is added, is automatically formed.

Example

Sub UserProc;
Var
    d: DateTime;
    b: Boolean;
Begin
    b := DateTime.TryParse("01.01.02", D);
End Sub UserProc;

If after executing the example the "b" variable contains True, the conversion was successful, and the "d" variable contains the date "01.01.02".

See also:

DateTime