Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
suzel404
Creator
Creator

Calculation 2 datetime in hours

Hi,

ID, STARTDATE, ENDDATE   

130/10/17 18:59:0031/10/2017  10:30:00
230/10/17 19:16:0031/10/2017  12:00:00

I want to calculate the delay in hours from startdate and enddate.

INTERVAL(DATE(DATE#(ENDDATE, 'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss') - DATE(DATE#(STARTDATE, 'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss'), 'H') does not work.

Regards,

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Your start dates show only two year digits, hence your format code should show only two 'YY'.

Also check that there are no additional spaces etc. in your field values that are not part of your format code.

Besides that, you don't need to format the dates using Date() function, when you want to format the result of the subtraction using Interval().

View solution in original post

2 Replies
swuehl
MVP
MVP

Your start dates show only two year digits, hence your format code should show only two 'YY'.

Also check that there are no additional spaces etc. in your field values that are not part of your format code.

Besides that, you don't need to format the dates using Date() function, when you want to format the result of the subtraction using Interval().

suzel404
Creator
Creator
Author

Thanks,

I'll check !