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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

difference between time

Hi I have 2 datetime fields and I want to calculate difference between 2 fields of time

ex: date1 = 2010-11-19 09:22:09.000   date2 : 2010-11-19 11:52:38.000

then date3 =date2- date1 i.e (11:52:38.000-09:22:09.000).

how to caluclate it.

4 Replies
israrkhan
Specialist II
Specialist II

Hi Pankaj,


Did you try interval(EndTime-StartTime, 'hh','mm')


OR


Timestamp(Timestamp#(EndDateTime) - Timestamp#(StartDateTime), 'hh:mm:ss')


Khan

Not applicable
Author

HI

I tried first one but some times it shows wrong means

Ex : Date1 = 12:56,  Date2 : 19.43 then date3 returns = 6:47 but actually value is = 6:87

Clever_Anjos
Employee
Employee

time(frac(date2) - frac(date1))

Anonymous
Not applicable
Author

Hi Pankaj,

there is the Interval function, that calculates the difference between 2 dates:

Try using as below:

Interval( Date('2010-11-19 09:22:09.000') - Date( '2010-11-19 11:52:38.000'), 'hh:mm:ss')

Interval( Date('19:43') - Date( '12:56'), 'hh:mm:ss')