Dates in Coldfusion

I have been given a project in Cold Fusion.

There seems to be a problem with the dates. They are input into an Access database and then fed in to a page.  When called the dates should appear categoried by month however there seem to be confusion as the dates which go from 01 to 12 in the dates are treated as months and so you get for example 01 August appearing in January's section , however 26 August  appears in the correct August section.

See what I mean on http://specialofferstest.heartlands.org/main/events/index.cfm

I hope my question is clear enough. Please help!
fusionlessAsked:
Who is Participating?
 
JonnyWebConnect With a Mentor Commented:
<!--- Set Values Here --->
     <cfset FromMonth=1>
     <cfset FromYear=2002>
     
     <cfset ToMonth=2>
     <cfset ToYear=2002>
<!--- /Set Values Here --->

<!--- This Converts values to correct ODBC date range --->
     <cfset TheStart=CreateDate(FromYear,FromMonth,1)>
     <cfset TheTempEnd=CreateDate(ToYear,ToMonth,1)>
     <cfset TheEnd=CreateDate(ToYear,ToMonth,DaysInMonth(TheTempEnd))>
<!--- /This Converts values to correct ODBC date ranges --->

<!--- Modify this query --->
<cfquery datasource="#Application.DSN#" name="GetData">
     SELECT * FROM SomeTable
     WHERE SomeDate BETWEEN #TheStart# AND #TheEnd#
</cfquery>
0
 
JonnyWebCommented:
I am not sure how to best explain this but I recommend that you use the SQL BETWEEN statement.

SELECT * FROM SomeTable
WHERE SomeDate BETWEEN {d '2003-03-01'} AND {d '2003-03-31'}

You should have no problem creating the dates using the DaysInMonth, and DateFormat functions.

Note: the between statement includes the start and end values.

Let me know if that works.
0
 
fusionlessAuthor Commented:
JonnyWeb,

I am soory it has been so long sice I have responded. Your idea on solving my problem sounds good, however it resticts the results to a perticular month i.e. March. How would you pass the variable form the first file so that it would achieve the same result for Jan through to December.

Thanks
0
All Courses

From novice to tech pro — start learning today.