Type conversion functions

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:


Returns the input as a boolean data type (true` or false).

to_bool (0) = false
to_bool (married)

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.

Does not accept datetime values. Only accepts month, day, and year.

to_date (date_sold, '%Y-%m-%d')

Returns the input as a double data type.

to_double ('3.14') = 3.14
to_double (revenue * .01)

Returns the input as an integer.

to_integer ('45') + 1 = 46
to_integer (price + tax - cost)

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 in the second argument (for example, to_string ( <date column> , "%Y-%m-%d" )). Use strftime for the date format.

to_string (45 + 1) = '46'
to_string (revenue - cost)
to_string (date,'%m/%d/%y')

Was this page helpful?