ColdFusion Script to compare a date value

<cfscript>
    function isBetween(compVal, FirstVal, SecondVal)
        {
            var myRetVal = false;
            if(FirstVal LTE SecondVal)
                {
                    if(compVal GTE FirstVal AND compVal LTE SecondVal)
                    RetVal = true;
                }
            else
                {
                    if(compVal GTE SecondVal AND compVal LTE FirstVal)
                    RetVal = true;
                }                   
            return RetVal;
        }
</cfscript>

<cfif #isBetween(#DateFormat(10/25/2012,"mm/dd/yyyy")#, #dateFormat(10/20/2012,'mm/dd/yyyy')#,#dateFormat(10/30/2012,'mm/dd/yyyy')# )#>
    <cfoutput>The date is between the given values </cfoutput>
<cfelse>
    <cfoutput>The date is not between the given values </cfoutput>
</cfif>

Comments

Popular posts from this blog

how to add new line in google form questions | Fix for next line issue in google form questions

How to add new line in dropdown type question in google forms