Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two dates

Hi,

I having trouble in getting difference between two dates which is timestamp. I want the difference in "Days" and create a chart.

Example:-

Field 1 :- 4/11/2013 12:40:32

Field 2 :- 4/16/2013  12:00:00

The value should be "5 days"

17 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Check the date format is same in the field

[Field2] and Field1 is in this format 'MM/DD/YYYY hh:mm:ss', if not modify the format in the expression, hope this is the reason it is not working.

Regards,

Jagan.

Not applicable
Author

Ok. The date format is 'MM/DD/YYYY hh:mm:ss AM'. How can i modify the formula now?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Ceil(Interval(Date#([Field2], 'MM/DD/YYYY hh:mm:ss TTT') - Date#([Field1], 'MM/DD/YYYY hh:mm:ss TTT'), 'DD' ))

Regards,

Jagan.

Not applicable
Author

Hi Nirav Bhimani,

I used this in script side but if my date is 01/16/2013 42:00:00 then it will round up that date into 01/17/2013 18:00:00

so i don' want to that so what i can do for that

nirav_bhimani
Partner - Specialist
Partner - Specialist

Hi,

I think you need to used the Floor Function.

Regards,

Nirav Bhimani

sujeetsingh
Master III
Master III

Where is Sharu...

Do he is still facing some issue or he forgot the thread.

It should be marked as answered.

abhaytrip
Creator
Creator

Is is possible to have it in this format ?

date.PNG

All I want is to find out the diff between the two(The first col - The second col) and plot them on a graph.

VNPython
Contributor
Contributor

dear all, after trying all possible suggestions for this date difference yet still unable to get the correct 'days'. Example to find the difference between Invoice Date (29.03.23) and Order Date  (2.03.23). the date data are in text format. The closest I get is 54 😅 Shalom and regards to all seniors