SQL Reference
Formatting Functions
formatting considerations the format string can be any combination of characters and format patterns for each function specified in the docid\ naengoslrgk2ikpyh6lkc and docid\ naengoslrgk2ikpyh6lkc tables patterns can be uppercase or lowercase, but not mixed case yyyy or yyyy matches yyyy, but not yyyy any characters in the format string that are not part of a pattern match any character in that position in to date, to number, and to timestamp you can escape string literals that contain format patterns with quotes for example yyyy"a literal part yyyy" date and time formatting functions date and timestamp formatting patterns 126,461 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type the following modifiers can also be applied to a format pattern date and timestamp formatting modifiers true 820,820left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type date and time notes you can use time specifiers such as hh12 in to date their format will be validated, but their values will not affect the resulting date iso 8601 formats for dates can not be mixed with traditional formats for years, months, and days in to date and to timestamp values for ms, us, and ns are scaled up if they do not have leading zeros to timestamp('0 3', 's ns') corresponds to 300000000 ns and to timestamp('0 000000003', 's ns') corresponds to 3 ns conflicting information for the same pattern will cause an exception ex to date('05 31', 'dd dd') conflicting information across different patterns such as dd and ddd will generally give precedence to the pattern that appears higher in the table to timestamp converts a character value with the specified format to a timestamp type syntax to timestamp(character value, character format) 178,99,375 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type examples select to timestamp('2022/12/01', 'yyyy/mm/dd'); output 2022 12 01 00 00 00 000 select to timestamp('2023 02 28 13 43 20 403', 'yyyy/mm/dd hh24\ mi\ ss'); output 2023 02 28 13 43 20 000 to date converts a character value with the specified format to a date type syntax to date(character value, character format) 101,114,375 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select to date('2022/12/01', 'yyyy/mm/dd'); output 2022 12 01 number formatting functions number formatting patterns 100,490 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type number formatting notes you cannot mix pr with other sign indicators any character that does not match the corresponding group in the format string is ignored to number('1&2', '999') = 12 if pr is present, it must be after every 0 or 9 in the format string similar to to date and to timestamp, the fm is not considered a literal, but will not otherwise affect the behavior of to number to number converts a character value with the specified format to a decimal type syntax to number(character value, character format) 101,114,375 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select to number('5230 87', '9999v99'); output 5230 87 related links docid\ hem zd qwquv8dfnvnqz8 docid\ iwtcunl3t9rlghwvu2dsx docid\ ja8cont33tonx ktruedj