I have a table where the datetime is stored as varchar but represents the EPOCH time (e.g. 1556895150). How can I get that value to be recognized as a timestamp in Athena / using Presto? something like a dateadd function would work but Athena doesn't have dateadd (I envisioned something like dateadd('second',expressoin,'1970-01-01 00:00:00'. A simple CAST(expressoin as type) does not work here because EPOCH isn't a recognized datetime data type.
You can use from_unixtime()
:
presto> select from_unixtime(1556895150);
_col0
-------------------------
2019-05-03 07:52:30.000
(1 row)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With