> My records get time stamped when they are entered. It is a
> simple
> date/time field.
> What is the correct syntax for retrieving ALL records
> entered LAST
> MONTH.
> So, if today (Now()) is ANY day in September, show me all
> the records
> entered in August.
<cfset startdate =
dateadd("m",1,createdate(year(now()),month(now()),1)>
<cfset enddate = createdate(year(now()),month(now()),1)>
<cfquery ...>
select * from table
where datecolumn between #startdate# and #enddate#
</cfquery>
The reason you don't add -1 days to the end date is because if the
timestamp has a time value greater than midnight it will chop out any
records occurring on the last day of the month, so you want the end
date to be midnight of the next day.
s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218835
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