Get Involved. Join the Conversation.


    Tim Schobess
    OIC add millisecond to dateTime
    Topic posted September 23, 2019 by Tim Schobess, tagged Cloud, Integration, Mapping 
    49 Views, 5 Comments
    OIC add millisecond to dateTime
    Add a millisecond to a given dateTime Value in OIC

    I have an Integration where I need to add a millisecond to a given dateTime Value.

    For example: I get the following value: 2019-09-23T05:20:03.832+00:00

    I am able to convert this value using the dateTime function to this: 2019-09-23T05:20:03.832Z

    Then I want to add a milisecond to get this: 2019-09-23T05:20:03.833Z

    But unfortunately I am not able to add a milisecond to this value. I always get an execution error.

    Anyone now how to do this is in the MappingBuilder of OIC?




    • Kanchankumar Khedkar

      You can try something like this -

          <xsl:value-of select="xsd:dateTime($dateReceived) + xsd:dayTimeDuration('P1S')"/>

      This is supported in XSLT2.0 which is used in OIC. 

      You might have to edit xsl in outside mapper and import it. 

      If it does not work, you may try to define duration in variable and try addition as below:

      <xsl:variable name="duration" select="xsd:dayTimeDuration('P1S')" />

       <xsl:value-of select="xsd:dateTime($dateReceived) + xsd:dayTimeDuration('P1S')"/>


      • Hemanth Lakkaraju

        The ask is for 1millisecond and not 1second. Also the duration expression is incorrect - It should be PT1S for 1 second.

        I believe there is no duration expression for millisecond. The only way I believe or know is to crudely fetch the value of millisecond and add +1 to it and reconstruct the date.


        Just wondering what kind of a requirement/usecase asks for an increment of 1millisecond.

        • Malkit Bhasin

          I agree with Hemanth and also wondering the application design that require granularity of 1 milli-seconds.

          If indeed this is the requirement one easy way to do this would be to write custom javascript function that get time in millis (getTime()) and then add 1 and return the date time in desired format. 

        • Kanchankumar Khedkar
          Thanks Hemanth for correcting me. :) I missed milisecond part. My bad
      • Tim Schobess

        Thanks for you quick answer and excuse my delayed response.
        I was not able to get this working with your suggested approach, but reading through the replies I think it was based on the 'P1S' expression.

        Neverless I found another workaround for my usescase where I do not need to increase a Datetime, but using the custom javascript would also be a feasible way.

        Answering the question about the usecase: We are polling Data from a Server using a REST Api. We are filtering in the Service using a Datetime column. Unfortnuatly the Service has a bug
        which means that when we Call the Service using a 'greater than' Param on the DateTime it behaves like we used 'greater or euqal'. Since we cannot wait for the 3pl System to fix this issue on their side
        we were trying to find another way, and increasing the Datetime by one millisecond was one approach.