Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rupshall10
Contributor II
Contributor II

Convert Decimal to Time

Hi Guys

First time resorting to posting on here

I have a time field that arrives in QlikView as a decimal number e.g. 1215

This value represents 12 hours and 15 minutes

I am summing this field and therefore need the value to be represent as 12.25 in decimal or 12:15 in time

Is this possible?

7 Replies
vishsaggi
Champion III
Champion III

Try this ?

=interval(12.25/24,'h:mm')

maxgro
MVP
MVP

maketime(left(num(field,'0000'),2), right(num(field, '0000'),2))

1.png

swuehl
MVP
MVP

Maybe use interval#() to parse your values:

Interval(Interval#(1215,'hmm'))

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you are sure that your time values never exceed 23:59:59, you can also use Time#(D, 'hhmm') to parse your values. Which may be more logical to you.

Otherwise, use Interval#() which will accept any value and recalculate all spillovers into correct values for Days, Hours, Minutes and Seconds.

rupshall10
Contributor II
Contributor II
Author

Thank you for this - it appears to be the best solution however an issues still persists...

The following code

Interval#(ExceptionValue,'hhmm') displays 1215 as 12:15 perfectly and 3645 as 36:45

however it displays 600 as 60:00 instead of 6:00

If I change the code to Interval#(ExceptionValue,'hmm')

600 displays correctly as 6:00 however 1215 displays as 04:35

Is there a way I can have the best of both?

swuehl
MVP
MVP

Maybe

Interval(Interval#(Num(ExceptionValue,'0000'),'hhmm'))

rupshall10
Contributor II
Contributor II
Author

perfect! many thanks