Используйте функцию date_format
или trunc
, или substr()+concat()
.
Демо:
hive> select current_date original_date,
> date_format(current_date,'yyyy-MM-01') `date_format`,
> trunc(current_date, 'MM') `trunc`,
> concat(substr(current_date,1,7),'-01') `substr`
> ;
OK
original_date date_format trunc substr
2018-05-30 2018-05-01 2018-05-01 2018-05-01
Time taken: 0.093 seconds, Fetched: 1 row(s)