The Following was downloaded from CodeCentral:
ID: 15090
Title:
Resolving Date Problem in SQL!
Terms:
No Special Terms
Name:
URL:
http://www.EskiDefterler.com
Summary:
Use a number (as date value) in SQL text
Description:
Use a number (as date value) in SQL text.
Example:
'SELECT * FROM Country WHERE Date1=36736'
Actually, a date value is a number.
So, #07.29.2000# = 36736.
If you find a date value as a number then can use FormatFloat
function:
str1=FormatFloat('#', Date) //str1='36736'
Finally,
Query1.SQL.Text= 'SELECT * FROM Country WHERE Date1=' +
FormatFloat('#', Date);
Note: This solution is properly work BDE, VB, MS-Access, MS-SQL.
Yet somehow, I cannot get this to work, and dates in SQL are always a
problem. Users may have their date settings differently.
Is there a solution to this problem that will always work for dates in
SQL, irrespective of the users settings?
Thanks
Johan Smit