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

Hive Select Time Stamp

New Contributor

I need to retrieve the time stamp column stored in YYY-MM-DD HH:mm:ss format to YYY-MM-DD HH:mm:ss.SSS, with SSS being 000 when no entry is there, and displaying values for which the 'SSS' entries are there. I need to do this using Hive select commands. Any help?
Sample:

hive> select created_date, FROM_UNIXTIME(UNIX_TIMESTAMP(created_date, 'YYYY-MM-DD HH:mm:ss.SSS')) as ts from gimp_global limit 10;

OK

2019-08-21 15:11:23.553 2019-08-21 15:11:23

2019-08-21 15:11:23.553 2019-08-21 15:11:23

For columns, where the format is in 'YYYY-MM-DD HH:mm:ss', I need it to return 'YYYY-MM-DD HH:mm:ss.000'

0 REPLIES 0