Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two dates in Hours,Days, Months and years

Experts,

  I have a requirement to find the difference between two dates in Hours,Days, Months and years.

Fop example : order_date 10/01/2012 , Ship_Date 10/12/2012. What i would like to do is Ship_Date - order_date = 12 days

Is there any way I could do this in expresion?

thanks in advance,

Aji Paul.

3 Replies
MayilVahanan

Hi

Try like this

=Interval(ShipDate-OrderDate,'d hhmm:ss') for day difference

For Year:

=Year(ShipDate) - Year(OrderDate)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
arjunkrishnan
Partner - Creator II
Partner - Creator II

Hai Aji,

Use this Code It's Work Fine

Floor(Interval(order_date-Ship_Date,'DD')) -> For Days

Floor(Interval(order_date-Ship_Date,'D HH:MM:SS'))->For Days With TimeStamp

Not applicable
Author

Like this

=Interval(Date(ShipDate,'DD/MM/YYYY hh:mm:ss')-Date(OrderDate,'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss')

Ex: These are your

order_date 10/01/2012  and

Ship_Date 10/12/2012

Result as per the given expression : 11/00/0000 00:00:00