Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

date difference in hour and minute

hi,

i have two date fields like date1 and date2.

date1 has value 2014-08-30 05:03:16.000

date 2 has value 2014-08-30 10:02:36.000

i want to find out the difference between date2 and date1 and need the output like 4.59....

Please let me know how its done..

Thanks

Ranjith Kumaran

5 Replies
Not applicable

Re: date difference in hour and minute

Attached is the document. Hope it helps.

Not applicable

Re: date difference in hour and minute

but the output become 4.12.20.. i need it as 4.59

thanks

Ranjith Kumaran

Highlighted
MVP & Luminary
MVP & Luminary

Re: Re: date difference in hour and minute

Suraj,

Let me suggest some changes to the solution you uploaded.

=time([date 2]-date1, 'HH:MM:SS')

The mask 'HH:MM:SS' is incorrect. It should be 'hh:mm:ss' (lower case). "MM" means "Month", which gives an incorrect result.

I believe the best function to use here is "interval()" rather than "time()". Time will give an incorrect result if the difference is greater than 24 hours. The solution I suggest is:

=interval([date 2]-date1, 'hh:mm:ss')

-Rob

Not applicable

Re: Re: date difference in hour and minute

Thank you very much Rob.

Re: date difference in hour and minute

QlikCommunity_Thread_132047_Pic1.JPG.jpg

hope this helps

regards

Marco