Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two dates


Hi,

I need to calculate the difference between two date for which I have been using the below expression

 

=round(date(End,'DD/MM/YYYY')-date(Start,'DD/MM/YYYY'))

where start is 21/07/2014 and end is 22/07/2014 and the expected result is 1

But, the value obtained is 0

So can anyone please let me know how this could be acheived.

6 Replies
ashfaq_haseeb
Champion III
Champion III

Try below

=Interval(date(End,'DD/MM/YYYY')-date(Start,'DD/MM/YYYY'))


Regards

ASHFAQ

syukyo_zhu
Creator III
Creator III

try left(date(End,'DD/MM/YYYY'),10)-left(date(Start,'DD/MM/YYYY'),10)

sibideepak
Creator II
Creator II

Hi Anushree_Shetty ,

Store both dates as variable .

And then make subtract ..You must get it

Thanks

Deepak

Not applicable
Author

Hi,

You can use following, get year, month, date from both the dates, then use num on them and get a difference.

for example, difference between 12/08/2014 and 01/01/2014 should be 223. Following code gives this result.

= num(makedate(2014, 08, 12)) - num(makedate(2014, 01, 01))

Thanks,

Arun

SunilChauhan
Champion II
Champion II

age(timestamp, date_of_birth)

Returns the age at the time of timestamp (in completed years) of somebody born on date_of_birth.

Examples:

age('2007-01-25', '2005-10-29') returns 1 

age('2007-10-29', '2005-10-29') returns 2 

age(end,start)

Sunil Chauhan
Not applicable
Author

Hi Anushree,

Did you check my answer? Can you confirm if it's correct please.

Thanks,

Arun