Question
Help with filtering a query with a date as string column
Hello -- I've got a table column that contains dates as
string/text type (access db). I need to make a query of my table
that includes only the dates that match today's date (example
5-13-2008). I need two parts. One is to capture today's date, and
another to set the filter in the query.
Here's my base query
<cfquery name="someQuery" datasource="someDS">
SELECT col1, col2, dateCol, col4
FROM someTable
WHERE dateCol = "today's date"
</cfquery>
What's the best way to capture today's date? And then what's the best way to set it to a string so I have an object to compare with dateCol. I know #now()# will get today's date, however it returns date + time. How can I format it as M-D-YYYY? Then, how do I convert it to a string so I can evaluate in my query? Any help is appreciated!
Here's my base query
<cfquery name="someQuery" datasource="someDS">
SELECT col1, col2, dateCol, col4
FROM someTable
WHERE dateCol = "today's date"
</cfquery>
What's the best way to capture today's date? And then what's the best way to set it to a string so I have an object to compare with dateCol. I know #now()# will get today's date, however it returns date + time. How can I format it as M-D-YYYY? Then, how do I convert it to a string so I can evaluate in my query? Any help is appreciated!
