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

Difference between 2 dates

Hi

I have 2 date fields in the format

question_date eg : jun-25-2011

answer_date eg:    jul-01-2011

i need to find the difference between 2dates , in above case 6 days ...how do i write this in an expression.

2 Replies
Not applicable
Author

Hi,

I have solve this problem in the script with the expression:

answer_date - question_date AS difference

Maybe you have to try

num(answer_date) - num(question_date) AS difference

if you converted the date field into the format 'jun-25-2011'.

Regards

Vicky

Not applicable
Author

Hi,

      PFA. I have used mapping function to map Month names to numeric values i.e Jan is 1, Dec is 12 . Then created the dates in M/D/YYYY format using makedate() function. You may then apply logic for subtracting the two dates as needed. Hope this helps.

Thanks.