hiveql - string to date - hive SQL -


i running queries in hive environment.

i have column has timestamp set string in tables. tried following : of them return null

select  ,to_date(activitydate) 

cast:

,cast(activitydate timestamp) 

this how data set in table:

appreciate inputs on how can convert :

05/12/2017 00:00:00         select   cust_id ,to_date(activitydate)  activity_date ,type type_of_contact   repl_task  to_date(activitydate) between '2014-01-01' , '2017-01-01' ; 

i running out of memory if run :

select   cust_id ,activitydate ,substr(activitydate,4,2) dt ,substr(activitydate,0,2) month  ,substr(activitydate,7,4) year ,type    task   activitydate >='01/01/2016 00:00:00' 

unix_timestamp function converts given format unix timestamp , from_unixtime function converts unix timestamp given format:

hive> select from_unixtime(unix_timestamp('01/01/2016 00:00:00','mm/dd/yyyy hh:m:ss'),'yyyy-mm-dd'); ok 2016-01-01 time taken: 0.118 seconds, fetched: 1 row(s) 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -