问题
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