Reputation: 123
Is there an equivalent of Hive's date_format function in Impala?
I need to change a date column to the first day of the month (e.g., '2020-09-29' to '2020-09-01'), so I had originally used: date_format(LOG_DATE,'yyyy-MM-01') as FIRST_DAY_MONTH
Thanks!
Upvotes: 1
Views: 3296
Reputation: 7407
Impala : -
You can use to_timestamp()
.
Pls use this to_timestamp('20200901','yyyyMMdd')
to get a timestamp.
Generic command may be to_timestamp(concat(substr(data_col,1,7),'-01'),'yyyy-MM-dd')
Hive : -
You need to use to get a timestamp.
from_unixtime( unix_timestamp('20200901','yyyyMMdd'))
Upvotes: 2