Conversion functions are used to convert data from one type to another to meet specific computational or data format requirements. Conversion functions ensure data compatibility and correctness when processing data from different sources or formats. This topic describes how to use conversion functions in built-in functions.
BI_DATEFORMAT
BI_DATEFORMAT is used to format dates and output text.
Syntax | BI_DATEFORMAT(date, format) |
Description |
|
Description | Formats the date and outputs the text. |
Output data type | String |
Examples | BI_DATEFORMAT(2020-09-29, 'yyyyMMdd') = '20200929' |
BI_TODATE
BI_TODATE is used to convert a string to a date type.
Syntax | BI_TODATE(date_string, format) |
Description |
|
Description | Parses a string <date_string> in the <format> format and converts it to the date type. |
Output data type | Date |
Examples | BI_TODATE('2020-09-29', 'yyyy-MM-dd') = 2020-09-29 |
BI_TODOUBLE
BI_TODOUBLE is used to convert text or numeric values into floating-point numbers.
Syntax | BI_TODOUBLE(expression) |
Description | expression: the text or value to be converted. |
Description | Converts text or numeric values into floating-point numbers. |
Output data type | N/A |
Examples | BI_TODOUBLE('123.21') = 123.21 BI_TODOUBLE(3) = 3.0 |
BI_TOINT
BI_TOINT is used to convert text or numeric values into integers.
Syntax | BI_TOINT(expression) |
Description | expression: the text or value to be converted. |
Description | Converts a text or number to an integer. If a decimal part exists, it is discarded. |
Output data type | N/A |
Examples | BI_TOINT('123.9') = 123 |
BI_TOSTR
BI_TOSTR is used to convert a numeric value to a string.
Syntax | BI_TOSTR(expression) |
Description | expression: the value of the line to be added. |
Description | Converts a numeric value into a string. |
Output data type | String |
Examples | BI_TOSTR(123) = '123' |