<cfset FutureDate = #CREATEODBCDATE(now() + form.departdate)#>

I'm not sure exactly what that code would do, but it's cleaner (and
probably works better) to use DateAdd() to add days to an existing date.

Since your date field is a varText you can't directly compare it to a
ODBC date (I assume mysql would implicitly cast the date to a string).
It might work if you CAST( DEPART_DATE AS date ) in your comparison.
iirc typing in mysql is a bit dodgy, so good luck.

Kam

-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 28, 2004 8:15 AM
To: CF-Talk
Subject: Dates in Queries - Again

I don't know why I have so much trouble with this..

OK, I need to get all records with a depart date starting today and for
the next 15 days...

So, first set the variables...

<cfset TodayDate = #CREATEODBCDATE(now())#> <cfset FutureDate =
#CREATEODBCDATE(now() + form.departdate)#>
<!--- form.departdate is a simple number showing number of days in the
future - 15, 30, 45. --->

..and then it seems this should work in the query:

WHERE DEPART_DATE >= #TodayDate# and DEPART_DATE <= #FutureDate#

But, it isn't working.


Problem 1: This database was handed to me to work with. It's mySQL. 
"DEPART_DATE" is a varText field and all the dates in it are listed as
"8/15/2004". This is probably causing all my headaches.

Simply switching the data type in the database doesn't work - the data
gets translated incorrectly.

So, advise on how to best correct this problem and get the query to work
correctly?


I'm only an idiot half the time...

-- 
Les Mizzell




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=36

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182839
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to