Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing dates

Status
Not open for further replies.

3dColor

Programmer
Jan 10, 2006
240
US
Code:
<cfset today = CreateODBCDate(Now())>

<CFQUERY name="QofQtoday" dbtype="query">
   	SELECT 		*
   	FROM 		GetStats
	WHERE 		GetStats.timeStampStats = #today#
</CFQUERY>

My WHERE statement above is not working the way I would like. These two outputted dates {d '2006-01-13'} are not equal 2006-01-13 22:05:56.0. So my question is how do i reformat the date to so i can compare just the date and not the hours, minute, seconds?

I tried this but I get an conditional error.

Code:
DATE_FORMAT(GetStats.timeStampStats, %Y-%m-%d) = #today#
 
Code:
select foo, bar, qux
from yourtable
where date(yourdatetimecolumname) = current_date
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top