How to convert timestamp to date in Presto?

user8818601 picture user8818601 · Oct 23, 2017 · Viewed 25.5k times · Source

I like to convert my timestamp columns to date and time format. How should I write the query from presto? my timestamp is UTC time. Thank you very much

Timestamp format"1506929478589"
After query convert it looks like "2016-10-25 21:04:08.436"

Answer

Piotr Findeisen picture Piotr Findeisen · Oct 23, 2017

You can convert timestamp to date with cast(col as date) or date(col).