I tend to use something like... <CFSET dtFrom = CreateODBCDate(Now())> <CFSET dtTo = CreateODBCDateTime(CreateDateTime(Year(Now()), Month(Now()), Day(Now()), 23:59:59))>
Thus you end up with a Date and a DateTime Then in SQL do a WHERE myFieldDate BETWEEN #dtFrom# AND #dtTO# The initial CFSETs may be a little off as I havent tested the code, usually we are building them up from a Form post. Alternitavely you could go for something like... WHERE myFieldDate > #dtFrom# if you know there are no future dates. HTH On Tue, 29 Mar 2005 15:41:25 -0400, Johnny Le <[EMAIL PROTECTED]> wrote: > Hi, > > I need to select all accounts registered today. I currently use: > WHERE datepart(yy, registration_date) = #dateformat(now(), "yy")# and > datepart(mm, registration_date) = #dateformat(now(), "mm")# and > datepart(dd, registration_date) = #dateformat(now(), "dd")# > > This works, but I figure there must be a shorter way to do it. The > registration_date is a datetime(8) type. I tried registration_date = > #Now()#. I tried registration_date=#dateformat(Now(), "mm/dd/yyyy")# but > none of them work. Please let me know if you have a better to do it. > > I am using SQL server 2000 and ColdFusion MX 6.1. > > Johnny > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase Captivate from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=52 Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2224 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
