Built-in Functions → toChar

toChar() is a conversion function that returns an equivalent string from given a date type expression and string format.

Note

toChar() is used to resolve a date type into a format appropriate for the locale. The function supports the following formats:
• mm-DD-yy
• dd-MM-yy
• day of week
• day month year

Important

It is recommended to use the formatDate function instead of toChar that will be deprecated in future releases.

Signature

toChar(date exp, string format)
  • date exp : the date expression to convert
  • string format : a string describing the format of the output

Returns

string

Example

This example converts timestamp values into strings with "MM-dd-yyyy" format.

toChar(SALES_BV.SourceColumns.TIME_ID,"MM-dd-yyyy")