Why select unix_timestamp('2022-07-29') returns null in hive?

Viewed 19

Select unix_timestamp(CURRENT_DATE) returns proper value but select unix_timestamp('2022-07-29') returns null in hive.Any idea how to get proper values by using unix_timestamp('2022-07-29') in hive?

1 Answers

Please use string format along with the function. Use

select unix_timestamp('2022-07-29','yyyy-MM-dd')

current_date works because internally hive converts it to a string format that hive recognizes and it is able to convert it to a unix timestamp integer.

Related