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

Use date to filter records

Status
Not open for further replies.

NickyJay

Programmer
Sep 1, 2003
217
GB
Hi All,

bit of a noobie question im afraid but i can t get my head around it!! not been using cf for a while so im struggling trying to filter my database records based on months. What i want is to allow the user to select the month they want from a dropdown and this will filter the records based on a date/time field in MSSQL.

What i cant get my head around is getting the month value from the database date field - stored as dd/mm/yyyy. not really done any splitting before so im stuck! anyone any pointer?

thanks!
 
Try this:
Code:
<cfquery name="dateByMonth" datasource="yourSource">
	Select yourDateColumn
	From yourTable
	Where Month(yourDateColumn)=#Val(Form.monthSelect)#
	And Year(yourDateColumn)=#Val(Form.yearSelect)#
</cfquery>

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top