Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active August 27, 2020 18:25
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/923f645b3944b7315c22ac693c17e94b to your computer and use it in GitHub Desktop.
Save JamoCA/923f645b3944b7315c22ac693c17e94b to your computer and use it in GitHub Desktop.
Adobe ColdFusion TimeFormat Bug?
<!--- 20200827 Adobe ColdFusion TimeFormat Bug?
When dumping data to Excel, some strings are incorrectly autocast as date/time values.
Blog: https://dev.to/gamesover/coldfusion-timeformat-conversion-testing-3m81
TryCF Lucee: https://www.trycf.com/gist/923f645b3944b7315c22ac693c17e94b/lucee5
TryCF ACF2016: https://www.trycf.com/gist/923f645b3944b7315c22ac693c17e94b/acf2016
TryCF ACF2018: https://www.trycf.com/gist/923f645b3944b7315c22ac693c17e94b/acf2018
--->
<cfset tests = ["9", "9A", "9p", "9#CHR(32)##CHR(32)##CHR(32)#A ", " 9 A ", "23", "15.4"]>
<cfoutput>
<cfloop array="#Tests#" index="thisTest">
<div>"#thisTest#" = #isValid("time", thisTest)#
<cftry>
"#TimeFormat(thisTest, 'HH:mm:ss.lll')#"
<cfcatch>ERROR"</cfcatch>
</cftry>
</div>
</cfloop>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment