TryParseDate(Value: String; Var Result: DateTime): Boolean;
Value. Value, which is converted into date format.
Result. Variable containing result in case of successful conversion.
The TryParseDate method checks if the the specified value can be converted into date format according to regional standard settings.
If conversion is possible, the Result variable will contain the conversion result and the method returns True, otherwise False.
Sub UserProc;
Var
CI: ICultureInfo;
Dt: DateTime;
B: Boolean;
Begin
CI := CultureInfo.Current;
B := CI.TryParseDate("25.07.2007 12:12:12", Dt);
End Sub UserProc;
After executing the example the "D" variable will contain the date "25.07.2007", and the "B" variable will contain the attribute of a successful conversion.
See also: