Created
May 23, 2024 08:43
-
-
Save trycf/b131c1489f1c0bb8dbbb721bb08d685c to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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