Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

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

Convert days format to Hours

Hi

I have "Time" field in the database with below format :

2 days 11:10:05 

I need to convert the days in hours.

The result should be 59:10:05

Thanks

Labels (1)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@Shahzad_Ahsan  One option:

subfield(Time,'days',1)*24+subfield(subfield(Time,'days',2),':',1)&':'&subfield(subfield(Time,'days',2),':',2)&':'&subfield(subfield(Time,'days',2),':',3)

like for example :

Data:

load *,
subfield(Time,'days',1)*24+subfield(subfield(Time,'days',2),':',1)&':'&subfield(subfield(Time,'days',2),':',2)&':'&subfield(subfield(Time,'days',2),':',3) as NewTime inline [
Time
2 days 11:10:05
3 days 12:30:55
];

 

output:

Taoufiq_Zarra_0-1612789755869.png

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@Shahzad_Ahsan  One option:

subfield(Time,'days',1)*24+subfield(subfield(Time,'days',2),':',1)&':'&subfield(subfield(Time,'days',2),':',2)&':'&subfield(subfield(Time,'days',2),':',3)

like for example :

Data:

load *,
subfield(Time,'days',1)*24+subfield(subfield(Time,'days',2),':',1)&':'&subfield(subfield(Time,'days',2),':',2)&':'&subfield(subfield(Time,'days',2),':',3) as NewTime inline [
Time
2 days 11:10:05
3 days 12:30:55
];

 

output:

Taoufiq_Zarra_0-1612789755869.png

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Shahzad_Ahsan
Creator III
Creator III
Author

Thank You @Taoufiq_Zarra 

Its working. 😊