Skip to content

Instantly share code, notes, and snippets.

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 trycf/7f1eceaedac0ec73cd07fea1075751b0 to your computer and use it in GitHub Desktop.
Save trycf/7f1eceaedac0ec73cd07fea1075751b0 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
writeoutput("<h3>datetime.lSDateFormat() member function</h3>");
try {
writedump(now());
dateissue = now();
writeDump(dateIssue.lsDateFormat('short'));
dateissue = "{ts '2021-11-24 12:34:41'}";
writeDump(dateIssue.lsDateFormat('short')); // throws error
dateissue = "2021-11-24";
writeDump( dateissue.lsDateFormat( 'short')); // throws error
}
catch(any e) {
writeDump(e.message);
}
writeoutput("<h3>lSDateFormat() function</h3>");
try {
dateissue = now();
writeDump(lsDateFormat(dateissue, 'short'));
dateissue = "{ts '2021-11-24 12:34:41'}";
writeDump( lsDateFormat(dateissue, 'short'));
dateissue = "2021-11-24";
writeDump( lsDateFormat(dateissue, 'short'));
}
catch(any e) {
writeDump(e.message);
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment