How toI change this time duration 1.80 into this 2.20

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KALEL KANATA
    New Member
    • Oct 2010
    • 1

    #1

    How toI change this time duration 1.80 into this 2.20

    How do I change this time duration 1.80 into this 2.20 in my DB2 query results

    I have a table that gives me time spent in the form of 1.80 meaning 1 hour and 80 min

    I have a query that pulls that data but I want the results of my query to take that 1.80 and convert it into 2.20 meaning 2 hours and 20 min.

    what should that look like in my query?
  • Lennart Jonsso
    New Member
    • Nov 2010
    • 1

    #2
    Brute force, there's probably more elegant ways of doing this:

    db2 "with T (n) as ( values 1.80 ) select int(n) + int(100*(n - int(n))) / 60, mod(int(100*(n - int(n))), 60) from T"

    1 2
    ----------- -----------
    2 20

    Divide the snd part with 100 and add to to the fst.

    /Lennart

    Comment

    Working...