Support Questions
Find answers, ask questions, and share your expertise

Hive table load time from timestamp

Highlighted

Hive table load time from timestamp

New Contributor

Hello all, i have a hive table with a column of datatype timestamp. The source table from which I am loading just have time(not date like timestamp) . I just want to load the time. But due to timestampdatatype it takes a default date. How i can write a query which just takes time from source table. I need the data type to remain as timestamp

1 REPLY 1
Highlighted

Re: Hive table load time from timestamp

Contributor

It is not clear if you're using two tables - a source and a destination table, or you simply want to select the time element from timestamp datatype from a single table.

Extracting the time from a timestamp involves extracting the different components in the timestamp, for example:

select concat(hour(current_timestamp()), ':', minute(current_timestamp()), ':', second(current_timestamp()));

** https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions