0

I am trying to write an hql query which gives me the number of hours between two timestamp.

So, far i am unable to do this. I have used hql hour function but that does not work if the

timestamp corresponds to different date. Please provide any input.

My hql query is

select count(*) from com.xxx.Request as request where   request.id = :id and hour(current_timestamp - request.lastEventDate) > :delay

1 Answer 1

5

well, you can use:

days(first_timestamp) * 24  + hours(first_timestamp)
     - days(second_timestamp) * 24 - hours(second_timestamp);
Sign up to request clarification or add additional context in comments.

1 Comment

This won't work if the dates being compared belong to different months

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.