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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar Management In CF Help Needed

Status
Not open for further replies.

wantstolearncfm

IS-IT--Management
Jun 29, 2004
160
GB
Hi,

I am currently designing a site for a client of mine. Now i have made my own blog scripting which allows him to add news articles, modify user data etc..
Now he wants a calendar made well a page with dates on per month, how do i make CF only select the pages in say march or april the field is a =Now() datetime in access.
Im guessing date diff or something like that?
I just need the query code to get the dates out
Code:
<Cfquery name="getevents" datasource="ric_data">
Select *
From events
Where event_date = 'this is where i need the code for a month [COLOR=red yello](it will be in a dynamic URL.ID but i just need to no what i need to put in here is it march or something like that?'[/color]
</cfquery>

CF Reference
The links of my knowledge
 
the query that is sent to the database will have

where event_date >= #2004-12-01#
and event_date < #2005-01-01#

you pre-determine the values of the date strings using cf, so the actual contents of the CFQUERY will have

where event_date >= ###startdate###
and event_date < ###enddate###

startdate will be the first day of the month for which you want results, and enddate is the first day of the following month

note you can't use BETWEEN because the datetime values have times



rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (course starts January 9 2005)
 
One method for returning entries within the given month would be

Code:
Select * from events
 Where month(event_date) = #month(now())#
   and year(event_date) = #year(now())#

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top