Converts a Pascal date type into an SQL string that can be processed by the SQL server as a date. In addition, the string is converted so that the SQL server can use the date regardless of the country setting in the SQL server.
function SqlDateTime(const D : DateTime): string;
The date value specified in D is converted into a date string that can be processed by the SQL server.
begin ShowMessage(SqlDateTime(CurrentDateTime)); end;
Rules to understand the script can be found here.
In this example, the current date and time is transferred to the SqlDateTime conversion function. The function generates an SQL string from this, which in turn contains an SQL conversion and is therefore independent of the language installation of the SQL server.
ShowMessage shows: CONVERT(datetime,'2001-10-29 19:25:54', 120)