191 total views, 3 views today

How to calculate Date Duration using XSL Transformation in Oracle BPEL

 

I had a requirement in Oracle BPEL, that subtracts two dates and convert the duration in weeks then update in a database field through Webservice, so here below is my requirement.

DURATION in Days = (Date1 – Date2)

Duration in Week = (DURATION in Days) / 7

Achieving the above duration in Java is easy. In Oracle BPEL, we need to handle XML and XSLT most of the time. Initially It took some time to calculate this duration but found this link everything works easy. Ok, here below is the calculation

 

The below XSLT function calculate duration between two dates and return the result in Weeks

 

Formula:

 


Example:

$Date1 = 1 Jan 2017

$Date2 = 31 Feb 2017

O/P => 8 (in Weeks)

 

The below XSLT function calculate duration between two dates and return the result in Weeks in Decimal

 

Total Duration

 

 


 

Duration in Days (Result in Decimal)

 

 

 

Duration in Weeks (Result in Weeks)

 

 

Example:

 

Date1 = 1 Jan 2017 8AM

Date 2 31 Feb 2017 5pM

DurationInDays = 58.37 (58 days 9 hours )

Duration in Weeks = 8.33 ( 8 weeks if using Round function )

govindan How to Calculate Date Duration using XSL Transformation in Oracle BPEL
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan How to Calculate Date Duration using XSL Transformation in Oracle BPEL
Connect me
By | 2017-07-20T20:24:18+00:00 July 20th, 2017|Categories: BPEL|Tags: |0 Comments
Like us on Facebook.
Connect!