CAS 6


User function formatdate2

Format dates by specification and return a text field.

Standard Format Examples

Format Description Examples
'd' Short date pattern 20020615 -> 6/15/2009
'D' Long date pattern 20020615 -> Monday, June 15, 2009
'f' Full date/time pattern (short time) 20020615 -> Monday, June 15, 2009
'F' Full date/time pattern (long time) 20020615 -> Monday, June 15, 2009 12:00:0 PM
'g' General date/time pattern (short time) 20020615 -> 6/15/2009 1:45 PM
'G' General date/time pattern (long time) 20020615 -> 6/15/2009 1:45:30 PM
'M', 'm' Month/day pattern 20020615 -> June 15

Notes

1 Invalid dates return blank.

2 Any backslash '\' character must be escpaed by doubling the character.

'm\\d\\y' formatdate2 DATE

3 CAS does not support timestamp values. Any format string that includes a timestamp will return 12:00:00.

'f' formatdate2 20210615
.→------------------------------.
↓Tuesday, June 15, 2021 12:00 AM|
'-------------------------------'

4 The function uses the .NET date format specification. Full details can be found here.

5 Format are not cultue sensitive. Results are based on English standard output. See more here.