Link to home
Start Free TrialLog in
Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on

compare dates using coldfusion

I got a simple prroblem here .I have 1 date that is hard coded and i need to compare that date to the system date. so if the hardcoded date is less that sys date give access to the link if it is greater than than give diff access.

SO i wrote something like this

<cfset ldate='3/21/2008'>
    <cfset lcurDate=Now()>
    <cfif ldate lt lcurDate >
    <cfoutput query="getUSButNotCanada">
    	<br><b>Pro-Sunrise</b><br>
		-<link1>Survey1</a><br>
        -<link2>Survey2</a><br>
    </cfoutput>
    </cfif>

Open in new window

Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Does this help:

    <cfset datePart= ListToArray('3/21/2008',"/") >
    <cfset ldate= CreateDate(datePart[3],datePart[1],datePart[2]) >
    <cfset lcurDate=Now()>
<cfdump var="#ldate#" >
<br>
<cfdump var="#lcurDate#" >
    <cfif ldate lt lcurDate >
    <cfoutput query="getUSButNotCanada">
    	<br><b>Pro-Sunrise</b><br>
		-<link1>Survey1</a><br>
        -<link2>Survey2</a><br>
    </cfoutput>
    </cfif>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial