3 Replies Latest reply: Mar 3, 2014 7:39 AM by webyildirim RSS

    How to get difference between 2 dateTimes as duration via using xpath on BPM 11g

    webyildirim

      Hi,

      Need to get difference between 2 date payload objects as duration format for using on HT expiration value. (i.e. returned as PT2055M or P1DT10H15M) Actually see infos on that links: http://docs.oracle.com/cd/E23943_01/dev.1111/e10224/bp_appx_functs.htm#autoId13, http://www.avioconsulting.com/blog/bpel-date-duration-manipulation

      I could not find the right composition of functions to solve.

      Could you plz guide?

        • 1. Re: How to get difference between 2 dates as duration via using xpath on BPM 11g
          webyildirim

          I tried to execute this expression acc.to xpath2.0 xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(),"PT1D")-xp20:current-dateTime() to inteval or string element. After run fields obtain NaN value. What might be problem. But as i learnt, doesnt contain real xpath2.0 engine.

          Also i tried to solve the issue by creating duration such as concat("P", xp20:year-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:year-from-dateTime(xp20:current-dateTime()) ,"Y", xp20:month-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:month-from-dateTime(xp20:current-dateTime()),"M", xp20:day-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:day-from-dateTime(xp20:current-dateTime()),"DT", xp20:hour-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:hour-from-dateTime(xp20:current-dateTime()),"H",xp20:minute-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:minute-from-dateTime(xp20:current-dateTime()),"M") But realized that this approach interests with just only seperate values not whole values as expected. I could not find the right composition of functions to solve

          So, how can i achieve this issue? any comments are welcome.

          • 2. Re: How to get difference between 2 dates as duration via using xpath on BPM 11g
            Dan Atwood

            One problem it looks like you're having is caused by using "PT1D".  It should instead be "P1D".

             

            Hope this helps,

            Dan

            • 3. Re: How to get difference between 2 dates as duration via using xpath on BPM 11g
              webyildirim

              Thankyou for your attention. Fixed it, but nothing changes unfortunately.