@Gayathri DeviInstead 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 |
+----------------------+--+