Skip to main content
Inspiring
Sep 24, 2014 7:58 PM UTC
Answered

Date changed to default value when returned from IIF function

Hi,

can anyone please explain why the vDate is being displayed as a decimal number in the following code. It seems that the IIF() functions returns  some default value and not what I set

Thanks.

<cfset vNow = DateFormat(Now(), "mm/dd/yyyy")>

<cfoutput>

  vNow = #vNow# <br />

</cfoutput>

<cfset vDate = iif(true,  vNow, "")>

<cfoutput>

  vDate = #vDate# <br />

  Formatted vDate = #DateFormat(vDate,"mm/dd/yyyy")# #TimeFormat(vDate, "hh:mm:ss")#

</cfoutput>

This topic is closed to new replies. Start a new post to keep the conversation going.
aghanchiCorrect answer
Inspiring
Sep 24, 2014 9:13 PM UTC

nevermind. I had to apply Evalue(DE()) to the IIF paramater as follows and it is working:

<cfset vDate = iif(true,  Evaluate(DE("vNow")), "")>

1 reply

aghanchiAuthorCorrect answer
Inspiring
Sep 24, 2014 9:13 PM UTC

nevermind. I had to apply Evalue(DE()) to the IIF paramater as follows and it is working:

<cfset vDate = iif(true,  Evaluate(DE("vNow")), "")>

Translate