Wednesday, September 2, 2026

OIC - Calculate Difference Between Two Dates in Minutes

 In Oracle Integration Cloud (OIC), we may need to calculate the time difference between two date/time values and return the result in minutes.

Input Format

The Start Time and End Time are received in:

yyyy-MM-dd HH:mm:ss

Example:

Starttime: 2026-09-02 10:15:00

Endtime:   2026-09-02 11:45:00

XSLT Expression

Use the following expression in the OIC mapper:

xsd:integer(

  (

    xsd:dateTime(

      concat(

        replace(/nstrgmpr:execute/ns18:request-wrapper/ns18:endtime, " ", "T"),

        ":00"

      )

    )

    -

    xsd:dateTime(

      concat(

        replace(/nstrgmpr:execute/ns18:request-wrapper/ns18:starttime, " ", "T"),

        ":00"

      )

    )

  )

  div xsd:dayTimeDuration("PT1M")

)


How it works

  • replace() changes the space between date and time to T.
  • xsd:dateTime() converts the value into a date/time.
  • End Time is subtracted from Start Time.
  • xsd:dayTimeDuration("PT1M") represents 1 minute.
  • div converts the duration into the number of minutes.
  • xsd:integer() returns the final result as an integer.

Example

Start Time: 2026-09-02 10:15:00

End Time: 2026-09-02 11:45:00

Result: 90 minutes


This is useful when an OIC integration needs to calculate processing time, elapsed time, SLA duration, or execution duration between two timestamps.

Featured Post

OIC - Calculate Difference Between Two Dates in Minutes

 In Oracle Integration Cloud (OIC), we may need to calculate the time difference between two date/time values and return the result in minut...