troubleshooting Question

How to round a number in SQL Server when working with converting minutes to Days Hours Minutes

Avatar of RUA Volunteer2?
RUA Volunteer2?Flag for United States of America asked on
Microsoft SQL ServerSSRSMicrosoft Server OS
4 Comments3 Solutions18 ViewsLast Modified:
I have the following code that works except that the numbers are rounding up on the Days and Hours. Can someone tell me what I need to do to stop this from happening in the SQL? I have been using the round function but I must be doing something wrong in the rounding. I need this as accurate as possible. Any advice appreciated. 

 datediff(Minute ,opty.create_date, job.finish_date) as Start_Finish_Min
 ,datediff(dd ,opty.create_date, job.finish_date) as Days
 ,datediff(hh ,opty.create_date, job.finish_date) % 24 as Hours
 ,datediff(mi ,opty.create_date, job.finish_date) % 60 as Minutes
 from tbl_jobs js where dates between '20210701' and '20210728'
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 3 Answers and 4 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 3 Answers and 4 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004