Reputation: 119
How can I convert month name to month number in Hive ? Is there any inbuilt function available in Hive?
Eg: If I have "January" in one of the column, it should replaced to "01" using another table or using any other properties or Udf.
Upvotes: 0
Views: 3325
Reputation: 563
Yes, date_format(date/timestamp/string ts, string fmt)
Converts a date/timestamp/string to a value of string in the format specified by the date format fmt (as of Hive 1.2.0). Supported formats are Java SimpleDateFormat formats – https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html.
Upvotes: 1