#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Display time in munites


    Hi,

    I have two columns which I need to add together then devide by 60 in order to display that time in minutes. the problem I am facing is that at times I get numbers above 60 and my client doesn't want to see numbers above 60.

    i.e (col1 + col 2)/60 = 34.87

    what I need to do is make sure that when the number reaches 60 it moves on to 35.

    Please help
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,580
    Rep Power
    1906
    Take a look at the ceil function (alternative link).
    Untested example:
    Code:
    ceil((col1+col2)/60)
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Re: display time in munites


    Hi thanks for the feedback. I found the following from OTN.


    SQLWKS> select round((col1 + col2)/60,2) org_ans
    2> from (select 1240 col1, 852 col2
    3> from dual
    4> ) a
    5>
    ORG_ANS 34.87
    1 row selected.
    SQLWKS> select trunc((col1 + col2)/60) min,
    2> mod((col1 + col2), 60) sec
    3> from (select 1240 col1, 852 col2
    4> from dual
    5> ) a
    6>
    MIN SEC ----------
    34 52

IMN logo majestic logo threadwatch logo seochat tools logo