StringToDateTime will return a TDateTime value, built from the DateTimeStr value that is passed in.

DateTimeFormat describes the format of DateTimeStr - please refer to Date And Time Format Specifiers for help creating the DateTimeFormat parameter.

Declaration: Function StringtoDateTime( const DateTimeFormat : string; const DateTimeStr : string) : TDateTime

This example shows the date as a string variable, being converted into two (2) TDateTime formats.

procedure OnMapEvent(var Value:Variant);
var
MyStrDate : string;
 
begin
MyStrDate := '23/02/2026';
//Value will be equal to a TDateTime of 23/02/2026
Value := StringToDateTime('dd/mm/yyyy',MyStrDate);
 
//Value will be equal to a TDateTime of 2026-02-23
Value := StringToDateTime('yy-mm-dd',MyStrDate);
 
end;

A reference to this function can also be found under DateTime Functions at StringToDateTime (Conversion).