Find difference between timestamps in seconds in PostgreSQL using JOOQ

心不动则不痛 提交于 2020-01-02 21:02:58

问题


I need to find the difference between two timestamps in seconds using JOOQ. I have taken a look at some answers on StackOverflow using raw SQL, however i didn´t find a way to implement it using JOOQ.

Here are some solutions that i found that are using raw SQL:

  • Find difference between timestamps in seconds in PostgreSQL
  • MySQL: how to get the difference between two timestamps in seconds

回答1:


Use DSL.timestampDiff(timestamp1, timestamp2). It will return the difference in terms of an INTERVAL DAY TO SECOND type: org.jooq.types.DayToSecond



来源:https://stackoverflow.com/questions/51944427/find-difference-between-timestamps-in-seconds-in-postgresql-using-jooq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!