Casting unix time to date in Presto

deltap picture deltap · Jun 7, 2017 · Viewed 24.4k times · Source

I have timestamps stored in time since epoch (ms) and I would like to query and display results using a date formatted like 'yyyy-mm-dd'.

Answer

Christina Wallin picture Christina Wallin · Jun 8, 2017

cast(from_unixtime(unixtime) as date)

See https://prestodb.io/docs/current/functions/datetime.html for more datetime functions.