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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the difference between two dates like YY-MM-DD?

Hi Qlikheads

can any one help me ,How to get the difference between two dates like YY-MM-DD?

Thanks

John

4 Replies
Anonymous
Not applicable
Author

Hi,

Use like Date(Date#('Today()','YY-MM-DD') - Date#('14-12-12','YY-MM-DD') , 'MM/DD/YYYY')

For more info check the blog mentioned below

The Date Function

Thanks,

Vignesh

Not applicable
Author

you can use the internal function Age(param1,param2) where param1 and param2 are your two dates. It returns the difference in number of days. There is also a macro that can return years, months, days of difference.

Not applicable
Author

sorry is in years not days.

ie:

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

you can also check these threads:

Difference between two dates in Year,Month and ... | Qlik Community

SunilChauhan
Champion II
Champion II

if both are in same format then

you could use

date1-date2 as diffrence

other wise

DATE(date1,'YY-MM-DD') - DATE(date2,'YY-MM-DD') AS DIFFERENCE

OR

interval(Date1-Date2,'DD')

or

age(Date1,date2)

or

DATE(date#(date1),'YY-MM-DD') - DATE(Date#(date2),'YY-MM-DD') AS DIFFERENCE

hope this helps

Sunil Chauhan