Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/b131c1489f1c0bb8dbbb721bb08d685c to your computer and use it in GitHub Desktop.
Save trycf/b131c1489f1c0bb8dbbb721bb08d685c to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
function assert( actual, expected ) {
if ( expected == actual ) {
writeOutput( "✔" )
} else {
writeOutput( "✗" )
}
writeOutput( " expected `#expected#`, got `#actual#`<br>" );
}
todayDate = createDateTime(2024, 4, 7, 23, 45, 59, 999);
assert( datePart("yyyy", todayDate), 2024 );
assert( datePart("q", todayDate), 2 );
assert( datePart("m", todayDate), 4 );
assert( datePart("y", todayDate), 98 );
assert( datePart("w", todayDate), 1 );
assert( datePart("ww", todayDate), 15 );
assert( datePart("h", todayDate), 23 );
assert( datePart("n", todayDate), 45 );
assert( datePart("s", todayDate), 59 );
assert( datePart("l", todayDate), 999 );
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment