# App Development

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Did you mean:
Contributor III

## Duration between two Time fields not dates

Dear team,

I have a table where I have arrival time in one column and left time in another field, i need to know the duration between those two times

I am using qlik sense

the outcome should be in hours but decimal example 2.5 is two hrs and 30 min

1 Solution

Accepted Solutions
Contributor III
Author

at least i got a result but it was worng, what i am missing here is what i was using:

=Interval(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'),'hh:mm')

18 Replies
Contributor III

Hi,

You can try a Timestamp([Left Time] - [Arrival Time]) and use the format you want.

You can also chose to display as a duration in the measure parameters

Hope that helps.

Best regards

Contributor III
Author

it is just time filed, could be not recognized as such in qlik?

example currently have them as 18:40 in an excel column

Contributor III

What if you try something like this :

round(([Left Time]-[Arrival Time])*1440,0.02)

Champion

Hi,

you will need to use Interval() function

Take a look here to understand how it works: https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/FormattingFunc...

example:

Interval(left_time-arrival_time,'hh:mm')

Contributor III
Author

no also not working.

Contributor III
Author

Thank you

but didn't work i'm using this:

=Interval([Left Time]-[Arrival Time],'hh:mm')

Champion

then you will need to evaluate your timestamp fields correctly using Timestamp#()

like this

PS: if the format of your time field is this: DD/MM/YYYY hh:mm:ss then just replace it in the greyed part above

Contributor III
Author

at least i got a result but it was worng, what i am missing here is what i was using:

=Interval(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'),'hh:mm')

Contributor III
Author

hey i did it

this one works: so i was missing the timestamp

=(Timestamp#([Left Time],'hh:mm')-Timestamp#([Arrival Time],'hh:mm'))*1440

Tags
Community Browser