# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for
Did you mean:
Creator II

## Convert Decimal into hh:mm:ss

Hello all,

I want to convert decimal values into hh:mm:ss.

PFA excel file.

Can someone help me how to achieve this?

Thanks,

Nisha

17 Replies
MVP

It not seems the values are in proper format

Ex:-

1. Today date is 08/09/2017 if represent this date into NUM (Numbers) it will be 42986 and it is again converted into any date formats Ex:- ddmmyyyy, YYYYMMDD etc

2. This months  monthend date numeric value is 43008.999999988 which is 30/09/2017

Creator II
Author

I am checking with Data team regarding the format of decimal values. I think they just took time stamp from Date field and converted into Decimals.

For ex: 1.5 Decimal value should convert into 1:30:00.

Thanks,

Nisha

That means decimal values are in hour, below should work

=interval(YourField/24,'hh:mm:ss') as TimeValue

Creator

Hello Nisha,

Try this,

time(alt( date#( DecimalValue , 'yyyyddmm hhmmss' ),

date#( DecimalValue , 'hhmmss' ),

date#( DecimalValue , 'hh:mm.ss' ),

date#( DecimalValue , 'ss' ),

date#( DecimalValue , 'm.ss' ),

'hh:mm:ss') )  as DecimalValue1

Please find the .qvw.

Hope this help.

Master

Hi Nisha,

If the values are in days then

=Interval(DecimalValue,'hh:mm:ss')

That seems okay for some of your values

0.53 => 12:43:12

When we go over a DecimalValue of 1 then should consider changing your format

=Interval(DecimalValue,'D hh:mm:ss')

2.17 => 2 04:04:48

I would be nice to insert the letter 'day' into the format but that just messes things up:

Interval(2.17,'D day hh:mm:ss') = 2 2a0 04:04:48

you can work around this:

Replace(Interval(2.17,'D \$ hh:mm:ss'),'\$','days') and get 2 days 04:04:48

You can really go for it:

=Replace(Replace(Replace(Replace(Interval(2.17,'D \$ hh£mm#ss@'),'\$','days'),'£','hrs '),'#','min '),'@',' sec')

returns

2 days 04hrs 04min 48 sec

There are some really big values in your set, the largest is 1842608.42

1842608 days 10hrs 04min 48 sec

If the values are not days then you'll need to divide your argument by the appropriate quotient. If in seconds then divide by 86400 to get

21 days 07hrs 50min 08 sec for your largest value.

Regards

Andrew

Creator II
Author

Hello All,

Sorry for the confusion. Those decimal values are in Minutes.

Hope this helps.

Thanks Nisha

Partner

No problem, now it's clear. Let's try again. How about:

=Interval(DecimalValue/(24*60), 'hh:mm:ss')

The call to Interval() will make sure that very big values will still be converted to a massive amount of hours...For example, this application of the same expression on the last value in your Excel file:

=Interval(1842608.42/(24*60), 'hh:mm:ss')

will produce

30710:08:25

If you want different formatting, check Andrews post which contains a lot of useful advice.

 Sorry for the spam, post contained a lot of grammar and spelling mistakes. Time to go home

Master

Hi Nisha,

Your largest value comes out as:

=Replace(Replace(Replace(Replace(Interval(1842608.42/1440,'D \$ hh£mm#ss@'),'\$','days'),'£','hrs '),'#','min '),'@',' sec') =

1279 days 14hrs 08min 25 sec

or

=Interval(1842608.42/1440,'hh:mm:ss')=

30710:08:25

Regards

Andrew

Community Browser