To get forthcoming:
> #dateAdd('d',-1, Now())#
To get previous events from yesterday back
< #Now()#
You might want to look at the specific date functions for the DB you are
using. I prefer to let the DB do any work it can rather than CF. As long
as the business rules for what needs to be returned will not change, I'd
rather have the DB figure out the date I need.
On 5/23/07, Tom King <[EMAIL PROTECTED]> wrote:
>
> Ah ok,
> forgot to mention the time stamp I'm checking against won't have
> times, i.e 00:00:00 etc.
>
> So I need to do two things:
>
> One, get past events, two get forthcoming events:
>
> Past events has to get everything "yesterday" (by date) backwards,
> and forthcoming has to include today forwards:
>
> So for each of them, I just can't the syntax right to literally add
> or remove a day?
>
>
> T
>
>
>
> On 23 May 2007, at 13:28, Kris Jones wrote:
>
> > This is one way of doing it. But watch out. Got bit by some old code
> > that used this approach on the switch to daylight savings time. It's
> > better to add a day, then subtract a second.
> >
> >> If you want to check until midnight today:
> >>
> >> SELECT * from request.events WHERE EventDate <
> >> #createDateTime(Year(Now()),Month(Now()),Day(Now()),11,59,59)#
> >>
> >> Also, you might want to use <cfqueryparam> to pass in the value to
> >> SQL.
> >>
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278969
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4