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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Shahzad_Ahsan
Creator III
Creator III

How to calculate time difference

Hello Everyone

I want to calculate time difference.

It is calculating right but if the date is changed then it has problem.

You can see the second last row from the snapshot.

I have 4 fields in database startdate, starttime, enddate, endtime.

I want result 3:00 in second last row.

I have used this

=Interval (endtime - starttime, 'hh:mm')

Screenshot.jpg

1 Solution

Accepted Solutions
sumanta12
Creator II
Creator II

Hi 

Please try with this:

=IF(END_TIME>=START_TIME,

Interval(END_TIME-START_TIME,'hh:mm:ss'),TIME(Interval#('24:00:00','hh:mm:ss')-Interval(START_TIME-END_TIME,'hh:mm:ss'),'hh:mm:ss')

)

View solution in original post

2 Replies
sumanta12
Creator II
Creator II

Hi 

Please try with this:

=IF(END_TIME>=START_TIME,

Interval(END_TIME-START_TIME,'hh:mm:ss'),TIME(Interval#('24:00:00','hh:mm:ss')-Interval(START_TIME-END_TIME,'hh:mm:ss'),'hh:mm:ss')

)

Shahzad_Ahsan
Creator III
Creator III
Author

Thanks Sumanta