user2799983
user2799983

Reputation: 71

Converting SQL into coldfusion for DateDiff

i have a date field i have to manipulate, basically i have a query that gets everything and from that query i have to assign a variety of things, one of which is to get late counters. to accomplish this i have to calculate everything that was less than or equals to 90 days or greater than or equals to 90 days.

how can i do this

the answer below is not what i was looking for

Upvotes: 2

Views: 300

Answers (1)

Dan Bracuk
Dan Bracuk

Reputation: 20804

All the dates for the last 90 days?

select updateDate active
from a 
where xxxdate >= <cfqueryparam cfsqltype="cf_sql_date" 
value = "#dateadd('d', -90, now())#"> 

and xxxdate < <cfqueryparam cfsqltype="cf_sql_date" 
value = "#dateadd('d', 1, now())#"> 

Note that this:

cfsqltype="cf_sql_date" 

will strip the time portion away from the results of the datediff function result.

Upvotes: 4

Related Questions