Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select first day of month in presto

Tags:

presto

I'm trying to select the first day of the month for a date value in Presto (Hive Table). I've tried TRUNC(date,'MM') which works in Hive but not Presto.

like image 931
ericbrownaustin Avatar asked Dec 23 '22 07:12

ericbrownaustin


1 Answers

Use date_trunc('month', date_value)

presto> select date_trunc('month', DATE '2018-05-24');
   _col0
------------
 2018-05-01
(1 row)
like image 182
Piotr Findeisen Avatar answered Jan 14 '23 07:01

Piotr Findeisen