Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Dates in Coldfusion

Posted on 2003-03-11
Medium Priority
Last Modified: 2013-12-24
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

I hope my question is clear enough. Please help!
Question by:fusionless
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 8131079
I am not sure how to best explain this but I recommend that you use the SQL BETWEEN statement.

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.

Author Comment

ID: 8224241

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.


Accepted Solution

JonnyWeb earned 300 total points
ID: 8224968
<!--- 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#

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Open Page or Post…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question