Stephen Weiler Posted December 22, 2021 Share Posted December 22, 2021 I'm subtracting one date from another, hopefully to determine the elapsed time between the two dates. The query completes, but I cannot determine the unit of measure for the result. I'm hoping to know the number of hours (rounded up) between these dates. select h_datelogged, h_dateresolved, h_dateresolved-h_datelogged Difference from h_itsm_requests limit 2 Does anyone know the default unit of measure? Thanks! Link to comment Share on other sites More sharing options...
Victor Posted December 23, 2021 Share Posted December 23, 2021 @Stephen Weiler good question. I would have said seconds, but that number is not the number of seconds between those dates... honestly I have no idea what the query does with that difference... However, if you are after the number of hours between the two, use this: TIMESTAMPDIFF(HOUR, h_datelogged, h_dateresolved) AS difference Link to comment Share on other sites More sharing options...
Stephen Weiler Posted December 28, 2021 Author Share Posted December 28, 2021 Thank you! The TIMESTAMPDIFF() function is what I needed. I'm used to native SQL and was trying DATEDIFF() with no luck. I appreciate the help! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now