CFIF and date problems
first, know should go under general discusion, new system won't let me post there. think there bugs new forum pages.
anyway.... here's problem.
i have table storing starting dates , ending dates promotional flyers. table lists flyer pdf filename lick can made in output. problem no matter how put logic in cfif either or none of flyers list on ouput. desire have flyer show during promotional dates. here's i've got far. seems should easy, i've been staring @ long. suggestions may have.
<cfquery name="getflyers" datasource="sales">
select * flyers
order startdate
</cfquery>
<table>
<cfif #dateformat(getflyers.enddate,"m/d/yy")# gte #now()# , #dateformat(getflyers.startdate,"m/d/yy")# lte #now()#>
<cfoutput>
<tr><td><h4>#dateformat(getflyers.startdate,"m/d/yy")# thru #dateformat(getflyers.enddate,"m/d/yy")#</h4></td></tr>
</cfoutput>
</cfif>
</table>
i'd suggest using datecompare("date1", "date2" [, "datepart"]) perform evaluation, since works on date/time values. typically use datepart = "d" compare day. "gte" operators in code performing string, not date/time, comparisions , may never yield desired results.
datecompare returns:
• -1, if date1 earlier date2
• 0, if date1 equal date2
• 1, if date1 later date2
More discussions in Advanced Techniques
adobe
Comments
Post a Comment