Timestamp column is : 20210817 16:45
I want to extract only date part using Hive query language.
Please help me with this.
Timestamp column is : 20210817 16:45
I want to extract only date part using Hive query language.
Please help me with this.
Using regexp_replace:
select date(regexp_replace('20210817 16:45', '^(\\d{4})(\\d{2})(\\d{2}).*','$1-$2-$3'))
Result:
2021-08-17
Note: date() function is not necessary here, string in yyyy-MM-dd is fully compatible with Hive date type.