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: 
QFanatic
Creator
Creator

Calculate Difference in Time

Hi guys

Please find attached.

I need to calculate the difference in Time in script. Field name is  'Event_Duration'. I've tried doing it with interval but it returns nothing.

Where am I going wrong?

Thank you!

Labels (1)
1 Solution

Accepted Solutions
haskia
Partner - Contributor III
Partner - Contributor III

Hi 

Make sure to convert your date and time fields from strings into actual dates or times with Date#(), Time#() or Timestamp#().

Then you can easily use calculations like Interval() and they will work like a charm.. 🙂 

Example for Duration:

=Interval(Timestamp#(Event_End_Dt_Tm, 'YYYYMMDD hh:mm:ss') - Timestamp#(Event_Strt_Dt_Tm, 'YYYYMMDD hh:mm:ss'), 'hh:mm:ss')

View solution in original post

2 Replies
haskia
Partner - Contributor III
Partner - Contributor III

Hi 

Make sure to convert your date and time fields from strings into actual dates or times with Date#(), Time#() or Timestamp#().

Then you can easily use calculations like Interval() and they will work like a charm.. 🙂 

Example for Duration:

=Interval(Timestamp#(Event_End_Dt_Tm, 'YYYYMMDD hh:mm:ss') - Timestamp#(Event_Strt_Dt_Tm, 'YYYYMMDD hh:mm:ss'), 'hh:mm:ss')

QFanatic
Creator
Creator
Author

Thank you so much