Whoops.  Add just two months to get this month plus the next two.

.... DateAdd("m", 3, startdate)


----- Original Message ----- 
From: "Jim McAtee" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Thursday, May 18, 2006 3:15 AM
Subject: Re: ARGH! - Three Months in the future query problem


> Depends on what you're trying to do.  Do you want everything between 
> today
> and the date three months from today?  For instance 5/17/2005 to
> 8/17/2005.  Or do you want everthing from the beginning of May through 
> the
> end of July?
>
> The latter could be done with
>
> <cfset startdate = CreateDate(Year(Now()), Month(Now()), 1)>
> <cfset threemonths = DateAdd("m", 3, startdate)>
> <cfset enddate = CreateDate(Year(threemonths), Month(threemonths),
>                            DaysInMonth(threemonths))>
>
> WHERE event_date BETWEEN startdate AND enddate
>
>
>
> ----- Original Message ----- 
> From: "Les Mizzell" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[email protected]>
> Sent: Wednesday, May 17, 2006 10:28 PM
> Subject: Re: ARGH! - Three Months in the future query problem
>
>
>> Duh!
>>
>> This does it:
>>
>> WHERE event_date < #threemonths# and
>>       event_date >= #startDATE#
>>
>> See! Getting away from the computer and thinking about things while
>> walking your dogs really helps!!
>>
>>
>>> <cfset startDATE = #now()#>
>>> <cfset threemonths = DateAdd("m",3,startDATE)>
>>>
>>> <cfquery name="calendar">
>>> SELECT
>>> id, event_date, event_name FROM events
>>> WHERE month(event_date) >= #month(startDATE)#
>>>       and event_date < #threemonths#
>>>       and year(event_date) >= #year(startDATE)#
>>> ORDER BY event_date,event_time ASC
>>> </cfquery> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240878
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