我想从’1190102092000’字符串中获取时间戳。但我不想要微秒。TO_DATE(右(‘1190102092000’,12),‘YYMMDDHH24MISS’)
使用 TIMESTAMP(your_timestamp,0)
TIMESTAMP(your_timestamp,0)
例如
values TIMESTAMP(TIMESTAMP_FORMAT('2'||'1190102092000','YYYYMMDDHH24MISS'),0) 1 ------------------- 2119-01-02-09.20.00 1 record(s) selected.
您可以将原始时间戳(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