How to convert timestamp to date in presto?

by wilmer.lemke , in category: MySQL , 5 months ago

How to convert timestamp to date in presto?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lizzie , 5 months 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.

Related Threads:

How to convert unix timestamp to local date in oracle?
How to convert timestamp to yyyy-mm-dd hh24:mi:ss format in oracle?
How to convert timestamp to unix timestamp in laravel?
How to get year from timestamp in presto sql?
How to cast date as date string in presto?
How to convert mysql timestamp to awsdatetime with php?