Utility Function: DateBetween()
- October 23, 2008 11:59 AM
- ColdFusion, Utility Function
- Comments (0)
I get so tired of doing date comparisons to see if a date is between two other dates. Its not hard, but I always feel like it should be a method.
<cffunction name="DateBetween" output="false" access="public" returntype="boolean">
<cfargument name="testDate" type="date" required="true" />
<cfargument name="lowDate" type="date" required="true" />
<cfargument name="highDate" type="date" required="true" />
<cfargument name="inclusive" type="boolean" required="false" default="true" />
<cfif arguments.inclusive>
<cfreturn (lowDate lte testDate AND testDate lte highDate) />
<cfelse>
<cfreturn (lowDate lt testDate AND testDate lt highDate) />
</cfif>
</cffunction>