Hi all,
I am attempting to run a sql query to select records with a date older than 30 days ago. I don't get any errors but it doesn't return any results when I know that there are two results that should be returned. The date format in the database is mm/dd/yyyy. I'm using access 2000. Can anyone offer any advice as to why this isn't working?
thanks,
-Chris
the code is:
<!--- this creates a date variable for 30 days ago--->
<cfparam name="epoch" default="">
<cfset epoch = dateformat((now()- createtimespan(30,0,0,0)),"mm/dd/yyyy">
<!--- run query against date--->
<cfquery name="deleteOld" datasource="Easylink_cust_service">
select * from contentObjects
WHERE visible = 0
AND DateDeleted < #epoch#
</cfquery>
<!--- output results --->
<cfoutput>Today:#dateformat(now(),"mm/dd/yyyy"#, 30 days ago: #epoch# <br> </cfoutput>
<cfoutput query="deleteOld">
#DateDeleted#, #datecompare(DateDeleted,epoch)# <br>
</cfoutput>
Chris Sorel
chris@exnihilo.com
Remember, If you continue to do what you have always done,
you will continue to get what you have always gotten.
I am attempting to run a sql query to select records with a date older than 30 days ago. I don't get any errors but it doesn't return any results when I know that there are two results that should be returned. The date format in the database is mm/dd/yyyy. I'm using access 2000. Can anyone offer any advice as to why this isn't working?
thanks,
-Chris
the code is:
<!--- this creates a date variable for 30 days ago--->
<cfparam name="epoch" default="">
<cfset epoch = dateformat((now()- createtimespan(30,0,0,0)),"mm/dd/yyyy">
<!--- run query against date--->
<cfquery name="deleteOld" datasource="Easylink_cust_service">
select * from contentObjects
WHERE visible = 0
AND DateDeleted < #epoch#
</cfquery>
<!--- output results --->
<cfoutput>Today:#dateformat(now(),"mm/dd/yyyy"#, 30 days ago: #epoch# <br> </cfoutput>
<cfoutput query="deleteOld">
#DateDeleted#, #datecompare(DateDeleted,epoch)# <br>
</cfoutput>
Chris Sorel
chris@exnihilo.com
Remember, If you continue to do what you have always done,
you will continue to get what you have always gotten.