Date settings

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 22
Joined: Tue 16 Nov 2004 21:59

Date settings

Post by brekhof » Fri 03 Jun 2005 13:22

I want my program to be able to work with the date format 'dd-mm-yyyy' regardless of the workstation's regional settings. Is there a way to set the format to this for my MSSQL/SDAC components?


Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 03 Jun 2005 14:13

Usually you shouldn't do anything - Delphi performs all necessary operations automatically.

Posts: 11
Joined: Sun 20 Mar 2005 10:37
Location: Poland

Post by maciejw » Sat 11 Jun 2005 09:20

You can send date to MsSQL (or MSDE) in SQL STRING Format 'YYYYMMDD' which is translated to server for right form regardles of server date format.

f.e. MyQuery: TMsQuery;

MyQuery.SQL.Text := 'SELECT * FROM table_name WHERE date_field = ''19581207''';

you receive records where date_field equals tp December 7th 1958.

Post Reply