FROM UNIX TIME in Presto syntax
Presto does not support unix_timestamp()
function. You need to convert your varchar
to date
.
So:
now() BETWEENdate_parse(start_date, '%Y-%m-%d %H:%i:%s') ANDdate_parse(end_date, '%Y-%m-%d %H:%i:%s')
Adjust the date format string as per scenario.
For a full list of Presto date and time function, refer to: https://prestodb.io/docs/current/functions/datetime.html
I've used the code below to convert a unix timestamp to a date. You should then be able to compare it to the other two dates.
CAST(from_unixtime(unix_ts_col) AS DATE)
In the database I use, the unix timestamp has been stored as a string, so I had to cast it to an integer first.
CAST(from_unixtime(CAST(unix_ts_col AS INTEGER)) AS DATE);