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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
rajendra1918
Creator
Creator

How to compare two dates in qlik sense

Hi Friends,

I have two dates which is having current_date and old dates.

I want to to get from that how many days with hh:mm:ss

               Current date                    expire date

01.04.201031.10.2017

from the above dates i want to do subtract from expire date with start date.

Please help me. if there is any function available in qliksense.

Required:

dd hh:mm:ss

Regards,

Rajendra

4 Replies
swuehl
MVP
MVP

Not quite sure if I understood your setting, but if your dates are correctly interpreted as dates

(have a look at

Get the Dates Right

Why don’t my dates work?

)

then you can just subtract the date values to get the time interval between the two dates or timestamps.

You can use Interval() function to format the result.

For example

=Interval( Now() - Makedate(2017), 'dd hh:mm:ss')

rajendra1918
Creator
Creator
Author

Hi Stefan- Thanks for reply,

i have used "date((date(Field1,'MM/DD/YYY')-date(Field2,'MM/DD/YYYY')),'DD')"  expression

now able to get what i required.

Thanks for your inputs.

Regards,

Rajendra

swuehl
MVP
MVP

i would strongly suggest to use Interval() function to format a time interval, I think something like Date( ..., 'DD') will not give you the correct number of days.

Just compare

=Date(1,'DD')

vs

=Interval(1,'dd')

rajendra1918
Creator
Creator
Author

I will check with that and update you.

Thank you.

Regards,

Rajendra