将unix时间戳转换为H2时间戳
问题描述:
如何将1348560343598
之类的unix时间戳值转换为H2 Timestamp
?
How do I convert unix timestamp value like 1348560343598
to H2 Timestamp
?
我的一个表在BIGINT(19)
列中包含这些unix时间戳,我需要将它们转换为类型为TIMESTAMP
的列.
One of my tables contains these unix timestamps in a BIGINT(19)
column and I need to convert them to a column of type TIMESTAMP
.
答
好,请使用以下公式:
select DATEADD('SECOND', 1348560343, DATE '1970-01-01')
仅记得将时间戳除以1000.使用'MILLISECOND'
不起作用,您会得到Numeric value out of range
.
Just remember to divide the timestamp with 1000. Using 'MILLISECOND'
doesn't work, you will get Numeric value out of range
.