0

How do I get a string of format dd-mmm-yy eg. "26-FEB-19", into timestamp in hive? Cast isn't working as it only takes yyyy-mm-dd format

Luk
  • 2,186
  • 2
  • 11
  • 32

1 Answers1

0
select from_unixtime(unix_timestamp('26-FEB-19','dd-MMM-yy'))

Result:

2019-02-26 00:00:00

Read about format templates here:SimpleDateFormat

Similar question (different format): https://stackoverflow.com/a/49816456/2700344

leftjoin
  • 36,950
  • 8
  • 57
  • 116