Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
viveksingh
Creator III
Creator III

difference of two dates in variable

Hi All,

I have two date fields in two different variable. I want to calculate the dates difference in days. I used Interval(). but still no luck. below is my code

let vInput1con= peek('Input1',0,'CONF1');          //Input1= 20191210
let vInput2con= peek('Input2',0,'CONF1');        //Input2= 20200101
let vMinDate=Date(Date#('$(vInput1con)','YYYYMMDD'),'YYYYMMDD');
let vMaxDate=Date(Date#('$(vInput2con)','YYYYMMDD'),'YYYYMMDD');

Let vdays=Interval($(vMaxDate)- $(vMinDate),'D');

Please help o=in finding the no. of days. 

Labels (2)
2 Replies
Taoufiq_Zarra

may be :

let vInput1con= peek('Input1',0,'CONF1');          //Input1= 20191210
let vInput2con= peek('Input2',0,'CONF1');        //Input2= 20200101
let vMinDate=Date(Date#('$(vInput1con)','YYYYMMDD'),'DD/MM/YYYY');
let vMaxDate=Date(Date#('$(vInput2con)','YYYYMMDD'),'DD/MM/YYYY');

Let vdays=Interval('$(vMaxDate)'- '$(vMinDate)','D');
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Brett_Bleess
Former Employee
Former Employee

Vivek, did Taoufiq's post get you a working solution?  If so, please be sure to close out your thread by returning to it and on his post, use the Accept as Solution button to mark it which will give him credit for the help and let other Members know that worked.  If you did something different, please consider posting that and then mark it using the button after you post.  If you have further questions, please leave an update post.  It is appreciated if you close out your posts if possible.  

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.