Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active December 10, 2020 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/7fc7e05ff7121cb481989b57c05c3bd5 to your computer and use it in GitHub Desktop.
Save JamoCA/7fc7e05ff7121cb481989b57c05c3bd5 to your computer and use it in GitHub Desktop.
Here are some conflicting results when comparing date objects to strings using ColdFusion
<!--- 20201210 Comparing dates with ColdFusion
GIST: https://gist.github.com/JamoCA/7fc7e05ff7121cb481989b57c05c3bd5
--->
<h1>CFML Date Comparison</h1>
<ul>
<li><b>TRYCF:</b><ul>
<li>TRUE when using ColdFusion 2016 or Lucee 5, Lucee 4.5 or Railo 4.2.</li>
<li>FALSE when using ColdFusion 10, 11, 2018 & 2020. (NOTE: CF10 doesn't support ISO dates.)</li>
</ul></li>
<li><b>CFFiddle:</b><ul>
<li>TRUE when using ColdFusion 2016 or 2020.</li>
<li>FALSE when using ColdFusion 2018.</li>
</ul></li>
</ul>
<cfoutput>
<h2>"1/2/1999" IS parseDateTime("January 2, 1999")</h2>
#YesNoFormat("1/2/1999" IS parseDateTime("January 2, 1999"))#
<h2>"1/2/1999" IS parseDateTime("1999-01-02T00:00:00")</h2>
#YesNoFormat("1/2/1999" IS parseDateTime("1999-01-02T00:00:00"))#
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment