9 Replies Latest reply: Jan 2, 2017 1:22 AM by Arun Kumar

Date difference with respect to today's date

Hi all,

I have to calculate the date difference with reference to today() in terms of years,months and days

please let me how to achieve this in qlik sense.

Regards,

Arun

• Re: Date difference with respect to today's date

What is the expected output?

• Re: Date difference with respect to today's date

expected output for '28-Dec-14' - '20-Dec-16' is 2 years, 0 months,8days

• Re: Date difference with respect to today's date

Interval(now() - Datecolumn,'YY')

Interval(now() - Datecolumn,'MM')

Interval(now() - Datecolumn,'DD')

• Re: Date difference with respect to today's date

Interval can give out Year and Month? I don't think Interval can do this unless this is something new?

• Re: Date difference with respect to today's date

you can try like this ,but this is not recommended.

( year(Today())- year(datecol))&'Years :'&( month(Today())- month(datecol))&'Months : '&( Day(Today())- Day(datecol))&'Days '

• Re: Date difference with respect to today's date

It gives 1 year, -11 months, -30 days between 2016/01/01 and 2015/12/31.

It is technically correct but not usable...

BR,

Matus

• Re: Date difference with respect to today's date

Maybe something along this?

Age in Year Month Day Format

• Re: Date difference with respect to today's date

Hi,

this formula should work for short time differences.

=Year(Today() - datecol + 1) - 1900 & ' Years, '

& Num(Month(Today() - datecol + 1) - 1) & ' Months, '

& Day(Today() - datecol + 1) & ' Days'

Two things:

it gives incorrect result for datecol = Today - simple if can solve that

it gives you one extra day for each Leap Day - this seems to be much harder to solve...

BR,

Matus

• Re: Date difference with respect to today's date

Thank you matus kelemen

it worked for me..