# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Contributor II

## 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')

1 Solution

Accepted Solutions
Contributor II

## Re: How to calculate time difference

Hi

=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')

)

2 Replies
Contributor II

## Re: How to calculate time difference

Hi

=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')

)

Contributor II

Thanks Sumanta