如何在 HIVE 中将日期 2017-sep-12 转换为 2017-09-12

how to convert date 2017-sep-12 To 2017-09-12 in HIVE

我在转换 hive 中的日期时遇到了一个问题。我需要将 2017-sep-12 转换为 2017-09-12 。我怎样才能在 HIVE 中实现这个

使用 unix_timestamp(string date, string pattern) 将给定的日期格式转换为自 1970-01-01 以来的秒数。然后使用 from_unixtime() 转换为给定格式:

hive> select from_unixtime(unix_timestamp('2017-sep-12' ,'yyyy-MMM-dd'), 'dd-MM-yyyy');
OK
12-09-2017