ICultureInfo.TryParseDateTime

Syntax

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

Parameters

Value. Value converted into date with time type.

Result. Variable containing result in case of successful conversion.

Description

The TryParseDateTime method checks if the specified value can be converted into date with time format according to regional standard settings.

Comments

If conversion is possible, the Result variable will contain the conversion result and the method returns True, otherwise False.

Example

Sub UserProc;
Var
    CI: ICultureInfo;
    Dt: DateTime;
    B: Boolean;
Begin
    CI := CultureInfo.Current;
    B := CI.TryParseDateTime("25.07.2007 12:12:12", Dt);
End Sub UserProc;

After executing the example the "D" variable will contain the date and time "25.07.2007 12:12:12", and the "B" variable will contain the attribute of a successful conversion.

See also:

ICultureInfo