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:
| On SQL Server, Synapse, MySQL-family, SingleStore and ClickHouse connections, to_date functions are not currently supported. |
| Function | Description | Examples |
|---|---|---|
|
Returns the input as a |
|
|
Converts a value to a date.
Epoch values are not supported. |
|
|
Returns the input as a |
|
|
Returns the input as an integer. |
|
|
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, |
|
|
For to_date functions, we support the following codes:
Other strptime codes (for example %B, %j, %p) are not supported. Any combination works. The codes can appear in any order, and each separator can differ, as long as the format follows the value. For example, to_date('12-02:2026', '%d-%m:%Y'). Pad numbers to their full width. Use 4-digit years with %Y, and 2-digit years, months, days and time parts. Values with no separators (20261029) require this, and some warehouses (for example, Databricks) reject single-digit parts such as 2026-5-3. Two-digit years (%y): the warehouse decides the century, and the cutoff differs between warehouses. Prefer %Y. Letters are not separators. For example, the T in 2026-10-29T14:05 is not supported. Warehouse-native patterns are not supported. For example 'yyyymmdd' or 'YYYY-MM-DD'. They may appear to work on some connections but return wrong dates or errors on others: on Databricks and Denodo mm means minutes, and BigQuery accepts only % codes. |