convert unix timestamp to H2 timestamp

2019-02-13 14:56发布

问题:

How do I convert unix timestamp value like 1348560343598 to H2 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.

回答1:

Ok, using the following formula works:

select DATEADD('SECOND', 1348560343, DATE '1970-01-01')

Just remember to divide the timestamp with 1000. Using 'MILLISECOND' doesn't work, you will get Numeric value out of range.



标签: timestamp h2