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
.
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
.
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
.