Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

Convert decimal number to duration

Good morning,

i would like to convert during script load some decimal numbers to time hh:mm:ss like below:

Original Duration FormatFormatted Duration
0.09953703703703702:23:20
0.0003703703703703700:00:32

  

if i insert the fields ( in origianal format) on a table ad set "duration" as format, qlik sense calculate correctly the conversion.

2018-08-17 10_15_25-_TemplateEmptyApp(1) _ Sistema di visualizzazione modello dati - Qlik Sense.png

I Would like to obtain this result by using load script.

2018-08-17 10_16_11-TemplateEmptyApp(1) - Il mio nuovo foglio _ Fogli - Qlik Sense.png

I've already tried:
- time([Reload Duration]) as [Reload Duration]

- date([Reload Duration],'hh:mm:ss') as [Reload Duration])

- Interval(interval#(ceil([Reload Duration]),'D'), 'hh:mm:ss') as [Reload Duration]

and other solution but  no-one is working...

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
11 Replies
marcus_sommer

Try it with something like this:

time(num#('0.00037037037037037', '#,##0.###########', '.', ','))

     or maybe

time(num#(left('0.00037037037037037', 15), '#,##0.###########', '.', ','))

- Marcus

jmmolero
Partner - Creator
Partner - Creator

Please, share sample data and load  script.

I try this:

[table]:
LOAD  Interval([Reload time],'hh:mm:ss') as [Reload time format],
*;
LOAD *,
Timestamp#(End,'DD/MM/YYYY hh:mm:ss') - Timestamp#(Start,'DD/MM/YYYY hh:mm:ss') as [Reload time];
LOAD * Inline [
Start, End
'12/08/2018 05:07:32', '12/08/2018 05:08:04'

];

I stored the table in qvd and loaded the table again from qvd, the  time format remained..

Regards,