0

I have a column with string partition=201707070800, I need to convert this to 2017-07-08 , How can we achieve this is hive ?

Thanks

Ganesh
  • 167
  • 1
  • 7
  • 21

1 Answers1

1

Use substring function

select concat(substr(<column-string-date>,0,4),'-',substr(<column-string-date>,5,2),'-',substr(<column-string-date>,9,2)) from <table-name>;

this should give output like 2017-07-08

Shubham Srivastava
  • 1,807
  • 1
  • 10
  • 17