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

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Get Hours Between 2 dates

Hi,

im trying to calculate the number of hours between two dates and Im getting a 00 value.

This is my expression :

Interval( Timestamp(Date + Start,'DD/MM/YYYY hh:mm') - Timestamp(Date + Start,'DD/MM/YYYY hh:mm'), 'hh' ) as Difference,

can anyone help please?

Phil

Labels (1)
2 Replies
swuehl
Champion III
Champion III

zero hours returned looks right, since you are subtracting (Date+Start) - (Date+Start) and this is zero by definition.

By the way, no need to format your values using Timestamp() inside the Interval() function.

Anonymous
Not applicable

You can use an expression like it.

I created the inline table just for this example.

[tab1]:

LOAD

Interval( end - start, 'hh:mm' )  AS [Hours]

;

[tab2]:

LOAD

*

INLINE

[

start, end

'20/06/2017 13:45:00', '23/06/2017 16:00:00'

]

;