Learn about data type conversion functions.
Some formulas require the input to be of a particular data type. If you find that you want to pass a value to the function, but it is of the wrong data type, you can convert it using a conversion formula.
The following are the conversion formulas:
Function | Description | Examples |
---|---|---|
to_bool |
Returns the input as a boolean data type (true or false ). |
to_bool (0) = false to_bool (married) |
to_date |
Accepts a date represented as an integer or text string, and a second string parameter that can include strptime date formatting elements.Replaces all the valid strptime date formatting elements with their string counterparts and returns the result. Does not accept epoch formatted dates as input. |
to_date (date_sold, '%Y-%m-%d') |
to_double |
Returns the input as a double data type. |
to_double ('3.14') = 3.14 to_double (revenue * .01) |
to_integer |
Returns the input as an integer. | to_integer ('45') + 1 = 46 to_integer (price + tax - cost) |
to_string |
Returns the input as a text string. To convert a date data type to a string data type, specify the date format you want to use. | to_string (45 + 1) = '46'
to_string (revenue - cost)
to_string (date,('%m/%d/%y')) |