apache - Hive Unix Timestamp -


i'm not getting expected result unix_timestamp of hive

for example :

select from_unixtime(unix_timestamp('2015/02/01', 'yyyy/mm/dd')) table limit 1; 

output :

2014-12-28 00:00:00 time taken: 0.287 seconds, fetched: 1 row(s) 

i expected return 2015-02-01 , resulted else. understand because of epoch time ?

you have caps in date format. try using lowercase:

select from_unixtime(unix_timestamp('12/02/01','yyyy/mm/dd') table; 

results in: 2015-02-01 00:00:00

also can strip off time using:

to_date(from_unixtime(unix_timestamp('12/02/01','yyyy/mm/dd')) 

results in: 2015-02-01


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -