Melz
Melz

Reputation: 15

Hive table date column value converson

in Hive table value for one column is like 01/12/17.But I need the value in the format as 12-2017(month-year).How to convert it?

Upvotes: 0

Views: 27

Answers (1)

Vamsi Prabhala
Vamsi Prabhala

Reputation: 49260

Convert the string to a unix_timestamp and output the required format using from_unixtime.

select from_unixtime(unix_timestamp(col_name,'MM/dd/yy'),'MM-yyyy')

Upvotes: 1

Related Questions