Options
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Solved
Go to solution
Date Format in Impala
Labels:
- Labels:
-
Apache Impala
Rising Star
Created 11-16-2017 04:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1 ACCEPTED SOLUTION
Master Guru
Created 11-16-2017 01:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Gayathri Devi
Instead of cast you need to use from_unixtime
Try the below query will result correct outputs as you are expecting
hive# select from_unixtime(unix_timestamp('161223000001' ,'yyMMddhhmmss'), 'yyyy-MM-dd HH:mm:ss'); +----------------------+--+ | _c0 | +----------------------+--+ | 2016-12-23 00:00:01 | +----------------------+--+
hive# select from_unixtime(unix_timestamp('161223000001' ,'yyMMddhhmmss'), 'yyyy-MM-dd hh:mm:ss'); +----------------------+--+ | _c0 | +----------------------+--+ | 2016-12-23 12:00:01 | +----------------------+--+
1 REPLY 1
Master Guru
Created 11-16-2017 01:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Gayathri Devi
Instead of cast you need to use from_unixtime
Try the below query will result correct outputs as you are expecting
hive# select from_unixtime(unix_timestamp('161223000001' ,'yyMMddhhmmss'), 'yyyy-MM-dd HH:mm:ss'); +----------------------+--+ | _c0 | +----------------------+--+ | 2016-12-23 00:00:01 | +----------------------+--+
hive# select from_unixtime(unix_timestamp('161223000001' ,'yyMMddhhmmss'), 'yyyy-MM-dd hh:mm:ss'); +----------------------+--+ | _c0 | +----------------------+--+ | 2016-12-23 12:00:01 | +----------------------+--+
