dateDiff problem

Reply

Join Date: Sep 2009
Posts: 5
Reputation: grabit is an unknown quantity at this point 
Solved Threads: 0
grabit grabit is offline Offline
Newbie Poster

dateDiff problem

 
0
  #1
Sep 14th, 2009
Hi Folks
In my db i have a datelisted column formatted to short date ie dd/mm/yyyy)

My theory is that say if that datepart year is 2007 i want to list all dates that are then due on the same date in the year 2009.

I can make this work manually by using:
  1. <cfset getdate = Now()>
  2. <!---Get date for listing period--->
  3. <cfset renewYear = #DatePart("yyyy", getdate)# -1

What i want to do is make this dynamic. and i am trying to now is use dateDiff to work out the -1 part of the above.

I currently have:
a query as follows:
  1. <cfquery name="getrenew" datasource="#dsn#">
  2. SELECT ID, datelisted, renewaldue, region, area, hitcount, webcount, category, busname, buscontact, busphone, mailto, paymethod
  3. FROM listings
  4. WHERE Year(datelisted) = #DatePart("yyyy", Now())# - #dateDiff("yyyy",datelisted,Now())#

in theory this should give me (as an example only)
if the year datelisted is 2007
Year(datelisted) = 2009-2

I am getting an error though that tells me that datelisted is undefined in the dateDiff function

Can anyone please help or see another way to do this

cheers and thanks in advance
Grabit
Last edited by peter_budo; Sep 16th, 2009 at 2:51 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ColdFusion Forum


Views: 1197 | Replies: 0
Thread Tools Search this Thread



Tag cloud for ColdFusion
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC