15 Replies Latest reply: Nov 20, 2017 1:27 AM by Anil Samineni

# Difference between two dates

I WANT TO SHOW THE DIFFERENCE BETWEEN THE TWO DATES (The FIRST Col - The SECOND Col) and plot their values on a bar chart.
How can that be done ?
Thanks

• ###### Re: Difference between two dates

Try this?

TimeStamp(Field1, 'MMM D YYYY hh:mmTT') - TimeStamp(Field2, 'MMM D YYYY hh:mmTT')

• ###### Re: Difference between two dates

Hey ,

I tried this but it isn't working at all. shows no values.

• ###### Re: Difference between two dates

Can you share image simply using

Date1 - Date2 ??

• ###### Re: Difference between two dates

here you go !

• ###### Re: Difference between two dates

Try this?

Interval( (date(timestamp#(Field1,'MMM D YYYY hh:mmTT'),'DD/MM/YYYY')) -   (date(timestamp#(Field2,'MMM D YYYY hh:mmTT'),'DD/MM/YYYY')), 'd')

• ###### Re: Difference between two dates

I'm getting the values in Integer.

After Formatting , I get this.

But the diff in days isn't seen here :/

• ###### Re: Difference between two dates

Try to change format only DD not DD:MM:YYYY

Another way

Date((date(timestamp#(Field1,'MMM D YYYY hh:mmTT'),'DD/MM/YYYY')) -   (date(timestamp#(Field2,'MMM D YYYY hh:mmTT'),'DD/MM/YYYY')), 'DD')

• ###### Re: Difference between two dates

Got this using DD hh:mmTT ,Thanks Folks !

• ###### Re: Difference between two dates

Did you try Interval function.

• ###### Re: Difference between two dates

Yes I did , But I couldn't fetch any results.

• ###### Re: Difference between two dates

interval(Col1 - Col2, 'DD hh:mm ')

• ###### Re: Difference between two dates

Tried that as well , :/

• ###### Re: Difference between two dates

If those are names of fields with multiple values, better create a straight table with a separate row for each value combination for real_survey_date_sent and date_survey_received, and add an expression with one of the suggestions posted before.

Specifying a field name in a text box will return all values at once. And subtracting all values from all values will lead to a NULL result.

• ###### Re: Difference between two dates

Tried this , but No values are shown.