Try the DateDiff Function...
Neil
----- Original Message -----
From: "Kurt Wiersma" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 30, 2000 12:49 PM
Subject: Comparing Dates in CFIF
> I am try to construct a table which has all the events for a particular
week
> listed by date each event occurs. I have tried the code below but have not
> gotten
> any records from the db to show up dipite have the correct dates entered
in.
>
> I cannot seem to get test for two dates equal on another or being greater
> then or
> equal to another number to work. This occurs in the <CFIF
> events.startdate...>
> part of the code.
>
> Is there a better way I should be doing this?
>
> Thanks in advance for any help you can provide.
>
> --Kurt Wiersma
> Web Developer www.awardsone.com
>
> Here is the code:
>
> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4">
>
> <CFLOOP FROM="0" TO="6" INDEX="i">
> <TR BGCOLOR="black"><CFSET celldate = DateAdd("D", i, querystartdate)>
> <TD COLSPAN="3"><FONT COLOR="white"><CFOUTPUT><B>#DateFormat
> (celldate, "DDDD, MMMM D")#</B></CFOUTPUT></FONT></TD></TR>
> <CFLOOP QUERY="events">
> <CFIF (((DateCompare(events.startdate, celldate) IS -1) OR
> (DateCompare(events.startdate, celldate) IS 0)) AND
> ((DateCompare(events.enddate, celldate) IS 1) OR
> (DateCompare(events.enddate, celldate) IS 0)))>
> <!--- <CFIF (events.startdate LTE celldate) AND (events.enddate
> GTE celldate)> --->
> <!--- <CFIF celldate (GTE events.startdate) AND (LTE
> events.enddate)> --->
> <!--- Date for this cell is >= startdate AND <= enddate
> so print the event --->
> <TR><CFOUTPUT>
>
> <TD>#events.eventname#</TD><TD>#events.location#</TD><TD>#DateFormat
> (events.startdate, "M/D/YY")# #TimeFormat(events.eventtime, "hh:mm
> tt")#</TD>
> </CFOUTPUT></TR>
> <CFSET found = 1>
> </CFIF>
> </CFLOOP>
> <CFIF NOT isDefined("found")>
> <TR><TD COLSPAN="3">No events listed for this
> date</TD></TR>
> </CFIF>
> </CFLOOP>
>
> </TABLE>
>
>
>
>
>
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.