EasyCFM.COM ColdFusion Forums / MS Access Related Issues / Access Date Problems

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Access Date Problems

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

chrispilie
08-18-2008 @ 2:28 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 1
Joined: Aug 2008

I have a query that reteives dates out of an Access database. What I am trying to do is select 1 date out of many. The query I would like to use, looks like something as follows:

<cfset TodaysDate = #CreateODBCDate(Now())#>
     
<CFQUERY DATASOURCE="#DataSource#" name="GetDates">
SELECT WeekEndingDate
FROM Productivity
WHERE JobNumber = '#URL.JobNumber#' AND
     SubJobNumber = '#URL.SubJobNumber#' AND
     WeekEndingDate <= #TodaysDate#-7
            </CFQUERY>

The dates it has to choose from is:

8-17-08
8-24-08
9-7-08
9-14-08
9-21-08
9-28-08
10-5-08

When I try:

<cfoutput query="GetDates">#DateFormat(WeekEndingDate, "medium")#<br></cfoutput>

I get all the dates. I have tried numerous formats and no luck. The dates in the database are in ODBC format currently. Any suggestions would be wonderful! Thanks in advance!


GrowlyBear
08-19-2008 @ 12:36 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1314
Joined: May 2004

try
<cfset TodaysDate = DateAdd("d", -7, now())>

and in the query
WeekEndingDate <= #TodaysDate#

~~~~~~~~~~~~~~~~~~~
CF PaperClip
http://www.cfpaperclip.com
CF & OOP in baby steps.


Website Designed and Developed by Pablo Varando.