Round caluclated difference to nearest quarter hour

Posted on 2007-10-09
Last Modified: 2012-08-14
I have found functions here that round a time (such as 3:12pm) to the nearest quarter hour, however, I can't find anything to round a calculated difference to the nearest quarter hour.

I have total time in minutes that someone has worked on a project.  I need turn it into hours (rounding to the nearest qtr hour)

For example:  130 minutes = 2.25 hr
Question by:UniqueData
    LVL 18

    Accepted Solution

    Try this:

    declare @y int
    select @y = 130

    select cast(round(@y/15.00,0)/4 as decimal(10,2))

    ... think in 15 minute sections, hat's the trick !

    Hope this helps ...
    LVL 18

    Expert Comment

    Sorry, forgot the result:


    LVL 7

    Author Comment


    LVL 18

    Expert Comment

    Glad I could be of any help and thanks for the grade !

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    This is my first ever Article on EE or elsewhere; therefore, please bear with me if I have some discrepancies in my writing. I read many articles and questions related to "how to pass values to SSIS packages at run-time?"  Hence, this common ques…
    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now