How to convert timestamp to date in presto?

by wilmer.lemke , in category: MySQL , 14 days ago

How to convert timestamp to date in presto?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lizzie , 13 days ago

@wilmer.lemke 

In Presto, you can convert a timestamp to a date using the date() function. Here is an example query to demonstrate this conversion:

1
SELECT date(timestamp '2022-01-01 12:34:56') AS converted_date;


In this query, the timestamp is converted to a date using the date() function. The result will be a date value in the format 'YYYY-MM-DD'.


You can replace the timestamp value with your own timestamp column or expression in your query to convert any timestamp to a date in Presto.