How to convert timestamp to date in Presto?

You can use the date_format function (docs here: https://prestodb.io/docs/current/functions/datetime.html)

Here's an example:

date_format(charges.created, '%Y-%m') as rev_month

If for some reason you're comparing dates you don't need to do the conversion like that, you can do the following

where customers.created BETWEEN timestamp '2018-04-01 00:00:00.000' AND timestamp '2018-05-01 00:00:00.000' 

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

Tags:

Sql

Presto

Trino