This content applies to a previous version of CARTO
In October 2021 we released a new version of our platform. You can find the latest documentation at docs.carto.com
Back to Help Center
How to Combine String Values and Convert Them into a Date
Learn how to combine and convert several column values into a date with a PostgreSQL function.
To merge multiple string columns or values and convert the result into a date, apply a SQL query using the to_timestamp PostgreSQL function:
SELECT
*,
to_timestamp(date_col || ' ' || hour_col, 'DD-MM-YYYY HH24-MI-SS') as date
FROM
table
This example demonstrates concatenating two columns with a space separator, then converting the combined string into a timestamp using the specified format pattern.
