Getting month using the WHERE clause
Hi everyone,
I have an annual calendar that I output on my Web site. I want to give my users the option to view the calendar month by month. The dates are input in my database in a field called "Date" in the m/d/yyyy format. When the user clicks the link to view the January, February, etc. calendar, I thought it would create a url variable (calendar.cfm?month=january) (or the number of the month, march=3, april=4 [calendar.cfm?month=3])
Here is my code:
<cfset CalMonth = #url.month#>
<cfquery>
SELECT *
FROM Calendar
WHERE Date LIKE '%#CalMonth#%'
ORDER BY Date ASC, StartTime ASC
</cfquery>
The above works, but it outputs every day and month that has to do with whatever month number/word I use. If CalMonth is 3 or March, I want just the dates for the month of March to show up.
I hope this makes sense. Thanks in advance to anyone who can help!
