Soma Sekhar Kuruva
Soma Sekhar Kuruva

Reputation: 69

TIMESTAMP in hive?

I have one column , data as 'Apr 06 2016 05:30:30' it is not in the time stamp formate, when using this one as timestamp I am getting null values. So stored as string, now I want to do some calculation on this when it is in time stamp formate. for that i converted into unixtimestamp and getting back to timestamp formate but the value of the date is changed. I used conversions as 'select from_unixtime(unix_timestamp(start_time, 'MMM DD YYYY HH:mm:ss')) from temp;' I got value as '2015-12-27 05:30:30'. I want final data as '2016-04-06 05:30:30'.

Please help me on this

Upvotes: 0

Views: 589

Answers (1)

mgaido
mgaido

Reputation: 3055

You have just written the wrong format. The proper format string is 'MMM dd yyyy HH:mm:ss'. Take a look at https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html for reference for format strings.

Upvotes: 0

Related Questions