Search code examples
coldfusioncoldfusion-8

Setting a ColdFusion variable


I have a problem setting a variable where I am unable to set a variable as a ColdFusion variable that calculates anything that is less than or equals to 90 days from today as shown below. I am getting an error when I try to set the variable as below:

sLate = now() >= 90 

If I cannot create a variable as above, I would like to compare dates between now, and 90 days before now, and publish the output to a variable.


Solution

  • <cfset sLate=DateAdd("d",-90,now())>
    

    If in cfscript:
    sLate=DateAdd("d",-90,now());

    As others have mentioned you are using wrong syntax. Also from your last line I understand that you want a value 90 days earlier than now. -90 will give a value 90 days earlier and using 90 will provide value of 90 days later from current day.