Looks like you want less then equal today to 1 week back. So take a look at
this sample:
<cfset today = createOdbcdate(now()) />
<cfoutput>Today: #dateFormat(today,"DDD, dd-MMM-YYYY")# <br/></cfoutput>
<cfset oneWeekAgo = createOdbcdate(dateAdd("d",-7,today)) />
<cfoutput>A week ago: #dateFormat(oneWeekAgo,"DDDD dd-MMM-YYYY")#
<br/></cfoutput>
As for your query mysql might not like that date format so take a look at
createOdbcdate()
<cfquery name="rs_dailytip" datasource="#REQUEST.dataSource#">
SELECT *
FROM daily_tip_new
where tipdate >= #oneWeekAgo# and tipdate <= #today#
ORDER BY tipdate DESC
</cfquery>
Paul
-----Original Message-----
From: John Barrett [mailto:[EMAIL PROTECTED]
Sent: Thursday, 7 August 2008 2:33 PM
To: CF-Newbie
Subject: cfquery & currentdate
I am trying to modify a cfquery to not display data after the current date.
I tried to use the CURDATE() in MySQL, but that did not seem to work. I am
wondering if there is a way to set this is CF and use that in the Where
function? As you can see below I was able to do something, but I don't want
to change this daily!
The whole app will display tips for this month,and I am trying to figure out
what is the best way to go about this.
Thanks in advance,
John
My query looks like:
<cfquery name="rs_dailytip" datasource="#REQUEST.dataSource#">
SELECT *
FROM daily_tip_new
<!---where tipdate <= CURDATE()--->
where tipdate >= "2008-08-01" and tipdate <= "2008-08-07"
ORDER BY tipdate DESC
</cfquery>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3904
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15