Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM 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

2 Replies
swuehl
MVP
MVP

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'

]

;