ColdFusion Dates before a date -
i seem have brain fart here. i'm trying show users entered in database 14 days, or more, before today's date. reason either or no one, not ones need. here have. please tell me going wrong. thank you!
<cfset todaysdate = #dateformat (now(), "mm-dd-yyyy")#> <cfset checkdate = #dateformat(todaysdate-14,"mm-dd-yyyy")#> <cfquery name="getuser" datasource="dns_test"> select * login dateentered <= #checkdate# </cfquery> <cfoutput> <cfloop query="getuser"> #getuser.lastname#, #getuser.firstname# <br> <cfloop> </cfoutput>
you'll want use dateadd()
.
example: never use select *
, instead use column names... investigate using <cfqueryparam>
select lastname, firstname login dateentered <= <cfqueryparam value="#dateadd( 'd', -14, now() )#" cfsqltype="cf_sql_date">
Comments
Post a Comment