What is the best way do search on db date-time field using date-time criteria and getting the expected results.
Example: I have an sql statement written in VB6 and say I am using a Mdb database and searching on a datetime field.
As date-time criteria I am using 2007-11-28 11:29:15
How should I apply the criteria in the sql statement:
"... Where SomeDateField Between " & "#2007-11-28 11:29:14#" & " AND " & "#2007-11-28 11:29:16#"
or maybe
"... Where CSNG(SomeDateField) = CSNG(" & "#2007-11-28 11:29:14#" & ")"
Or ??
I want to avoid problems with the decimal portion of the datetime not representing the time precisely.
Example: I have an sql statement written in VB6 and say I am using a Mdb database and searching on a datetime field.
As date-time criteria I am using 2007-11-28 11:29:15
How should I apply the criteria in the sql statement:
"... Where SomeDateField Between " & "#2007-11-28 11:29:14#" & " AND " & "#2007-11-28 11:29:16#"
or maybe
"... Where CSNG(SomeDateField) = CSNG(" & "#2007-11-28 11:29:14#" & ")"
Or ??
I want to avoid problems with the decimal portion of the datetime not representing the time precisely.