How to split date and time in hive?

Hi Friendz,

I have query in splitting the date and time field in hive table.
My data is there in flat file in the below format :

101 200 01MAR2016:11:31:52 01MAR2016:11:59:59
102 300 04MAR2016:06:13:08 04MAR2016:09:19:07
104 500 03MAR2016:11:54:56 03MAR2016:15:56:34
105 800 03MAR2016:09:10:37 03MAR2016:09:52:03

I have created a table as below :
CREATE TABLE abc (ID int, Price double, Start_DTTM string, DEL_DT_TM string)
row format delimited fields terminated by ‘,’ stored as textfile;

And loaded data into the table.

Now i want to spit the Date and time separately.
Please guide me


U can use substring in hive

select SUBSTRING(Start_DTTM,1,10) as date, SUBSTRING(Start_DTTM,11,18) as time from abc;
just check with the indices numbers and try it in console

It works.
Thanks for the solution Rahul…!!