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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the days difference

Hi All,

Is there any function in QV like SQL function:datediff(day, startdate , enddate) ?

Thanks.

Labels (1)
4 Replies
tresB
Champion III
Champion III

Interval() ?

Like: Interval(startdate-enddate, 'DD')    // or changing the order of dates

Sokkorn
Master
Master

Hi Isaac,

Try to use Interval(EndDate-StartDate,'D') or simply use EndDate-StartDate to get day different.

Regards,

Sokkorn

Not applicable
Author

You can also sort it asc in a straight table and do an Above expression.

Example:

(Date)-(Above(Date))

Thanks

Stefan

techvarun
Specialist II
Specialist II

1. date((date(Field1,'MM/DD/YYY')-date(Field2,'MM/DD/YYYY')),'DD')

2. Interval(Field1-Field2,'dd')

3.date(timestamp#(Field1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY') as Date2,

  date(timestamp#(Field1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY') as Date1,


Interval( (date(timestamp#(date2,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY')) -  (date(timestamp# (date1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY')), 'd') as DTDiff

Use this thread

regards