Я написал следующий запрос:
select call_begin_date_time,
from_unixtime(unix_timestamp(replace(call_begin_date_time,'T',' '),
'yyyy-MM-dd hh:mm')-5*3600, 'MM/dd/yyyy hh:mm') as call_begin_dt_time_conv
FROM datawarehouse.charged_usage_fact
where partition_date = '201812' and universalid = '6002163910'
and billing_start_date = '2018-12-01' and record_validity_flag = 'Valid'
limit 1000;
Где, call_begin_date_time
принимает значения, такие как: 2018-12-03T18: 05: 36.000Z
Вывод вышеуказанного запроса показан ниже:
call_begin_date_time , call_begin_dt_time_conv
2018-12-01T23:03:46.000Z , 12/01/2018 06:03 (wrong)
2018-12-01T22:32:33.000Z , 12/01/2018 05:32 (wrong)
2018-12-01T16:32:35.000Z , 12/01/2018 11:32 (right)
2018-12-02T17:01:27.000Z , 12/02/2018 12:01 (right)
2018-12-02T17:01:35.000Z , 12/02/2018 12:01 (right)
2018-12-02T17:07:42.000Z , 12/02/2018 12:07 (right)
2018-12-02T17:12:56.000Z , 12/02/2018 12:12 (right)
2018-12-02T17:02:11.000Z , 12/02/2018 12:02 (right)
2018-12-02T17:06:20.000Z , 12/02/2018 12:06 (right)
Для 2018-12-01T23:03:46.000Z
я хочу, чтобы call_begin_dt_time_conv отображался либо как '12/01/2018 18:03' (i.e 24 hour format)
, либо как '12/01/2018 06:03 PM' (i.e 12 hour format)
.