我正在尝试从'1190102092000'字符串获取时间戳。但是我不要微秒。 TO_DATE(RIGHT('1190102092000',12),'YYMMDDHH24MISS')
答案 0 :(得分:0)
您可以将原始时间戳(timestamp(6))转换为timestamp(0):
call admin_cmd('describe select t original, timestamp(t, 0) t_no_ms from table(values TO_DATE(RIGHT(''1190102092000'', 12), ''YYMMDDHH24MISS'')) t(t)');
SQLTYPE_ID SQLTYPE SQLLENGTH SQLNAME_DATA SQLNAME_LENGTH
---------- --------- --------- ------------ ----------------
392 TIMESTAMP 26 ORIGINAL 8
392 TIMESTAMP 19 T_NO_MS 7
答案 1 :(得分:0)
使用TIMESTAMP(your_timestamp,0)
例如
values TIMESTAMP(TIMESTAMP_FORMAT('2'||'1190102092000','YYYYMMDDHH24MISS'),0)
1
-------------------
2119-01-02-09.20.00
1 record(s) selected.