TO_CHAR
Date function
Description
TO_CHAR converts a timestamp or numeric expression to a character-string data format. (Redshift SQL Language Reference TO_CHAR function)
This function is partially supported in Snowflake.
For more information about quoted identifiers in functions, click here.
Grammar Syntax
TO_CHAR(timestamp_expression | numeric_expression , 'format')Sample Source Patterns
Input Code:
SELECT TO_CHAR(timestamp '2009-12-31 23:15:59', 'YYYY'),
TO_CHAR(timestamp '2009-12-31 23:15:59', 'YYY'),
TO_CHAR(timestamp '2009-12-31 23:15:59', 'TH'),
"to_char"(timestamp '2009-12-31 23:15:59', 'MON-DY-DD-YYYY HH12:MIPM'),
TO_CHAR(125.8, '999.99'),
"to_char"(125.8, '999.99');TO_CHAR
TO_CHAR
TO_CHAR
TO_CHAR
TO_CHAR
2009
009
DEC-THU-31-2009 11:15PM
125.80
125.80
Output Code:
TO_CHAR
TO_CHAR
2009
Dec-Thu-31-2009 11:15PM
Known Issues
No issues were found.
Related EWIs
SSC-EWI-0006: The current date/numeric format may have a different behavior in Snowflake.
Last updated
