convert unix timestamp to H2 timestamp

后端 未结 1 923
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 21:07

How do I convert unix timestamp value like 1348560343598 to H2 Timestamp?

One of my tables contains these unix timestamps in a BIGINT

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 21:30

    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.

    0 讨论(0)
提交回复
热议问题