AJm
AJm

Reputation: 1023

How to get month name abbr instead of month number in Hive

I want month name instead of month number from a Date passed in HIVE

I am doing

select Month(date_field) from <tablename>;

this gives me a month number. How to get month names ??

Upvotes: 4

Views: 22079

Answers (2)

Narsireddy
Narsireddy

Reputation: 403

Use the below builtin function to get the month in short form. select from_unixtime(to_unix_timestamp ("28/01/2017 00:00:00",'dd/MM/yyyy HH:mm:ss'),'MMM')

Upvotes: 0

Vamsi Prabhala
Vamsi Prabhala

Reputation: 49260

Use MMM with date_format function.

date_format(date_field,'MMM')

To get the full month name, use

date_format(date_field,'MMMMM')

Upvotes: 12

Related Questions