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: 
prees959
Creator II
Creator II

Calculate Minutes between two times - not working

Hi,

Im trying to calculate the minutes between two datetime fields - but it is showing 00:00 for every record.

My calculation is :

time(

    date(Timestamp(UPDATED,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY hh:mm')  -

    date(Timestamp(CREATED,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY hh:mm'),'hh:mm') AS mins_difference,

can anyone help with the correct syntax please?

5 Replies
vvira1316
Specialist II
Specialist II

Hi Phil,

Sample Data/App may help to help you.

BR,

Vijay

vishsaggi
Champion III
Champion III

May be try this?

Interval(

    date(Timestamp#(UPDATED,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY hh:mm')  -

    date(Timestamp#(CREATED,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY hh:mm'),'hh:mm') AS mins_difference,

shraddha_g
Partner - Master III
Partner - Master III

minute(

interval(Timestamp(UPDATED,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY hh:mm') -

Timestamp(CREATED,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY hh:mm'),'hh:mm:Ss')

)

sujeetsingh
Master III
Master III

Use Interval function to calculate the date difference. Well plz check the format of both date fields it should not be string.

Anonymous
Not applicable

You can use an expression like it.

I created the inline table just for this example.

[tab1]:

LOAD

Interval( end - start, 'mm' )  AS [Minutes]

;

[tab2]:

LOAD

*

INLINE

[

start, end

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

]

;