'Hive TimeStamp Convertion from GreenPlum Code

Please help me to convert below Greenplum code to Hive supported one.

GP:

date_trunc('second', now())::timestamp without time zone load_time

Expecting to convert similar operation and output in hive



Solution 1:[1]

select timestamp(substr(current_timestamp,1,19)) as load_time

Result:

2022-02-08 13:18:27.0

substr() leaves only seconds, works as truncate. and timestampt() - to convert from string to timestamp datatype.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1