Mirror

Write a correct date in SQL (Views: 100)


Problem/Question/Abstract:

How to write a correct date in SQL

Answer:

The SQL date format does not change with the system settings. The date is saved in "MM/DD/YY(YY)" format. You can use this code to save the current date in SQL:

var
  sSQLDate: string;
{..}
sSQLDate := '''' + FormatDateTime('mm"/"dd"/"yyyy', Now) + '''';

<< Back to main page