0 Replies Latest reply on Jun 28, 2019 10:44 AM by 3426083

    Converting m/d/yyyy hh:MM:ss PN to iso 8601 xs:dateTime format, i.e. YYYY-MM-DDTHH:MM:SS.sss-07:00

    3426083

      Hi All,

       

      I am following below mentioned xslt mapping to translate from m/d/yyyy hh:MM:ss PN to YYYY-MM-DDTHH:MM:SS.

       

      Case 1:

      Input:imp1:TimeStamp--->6/9/2019 12:32:34 AM

       

      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      <xsl:template match="/">

      <top:tagDate>

               <xsl:call-template name="formatdate">

                   <xsl:with-param name="DateTimeStr" select="imp1:TimeStamp"/>

                </xsl:call-template>

                </top:tagDate>

        </xsl:template>

       

        <xsl:template name="formatdate">

           <xsl:param name="DateTimeStr" />

           <xsl:variable name="datestr">

               <xsl:value-of select="substring-before($DateTimeStr,' ')" />

           </xsl:variable>

           <xsl:variable name="timestr">

               <xsl:value-of select="substring-after($DateTimeStr,' ')" />

           </xsl:variable>

        

           <xsl:variable name="mm">

               <xsl:value-of select="substring($datestr,1,1)" />

               <!--xsl:value-of select="substring($datestr,1,2)" /-->

           </xsl:variable>

           <xsl:variable name="dd">

              <xsl:value-of select="substring($datestr,3,1)" />

              <!--xsl:value-of select="substring($datestr,4,2)" /-->

           </xsl:variable>

           <xsl:variable name="yyyy">

              <xsl:value-of select="substring($datestr,5,4)" />

              <!--xsl:value-of select="substring($datestr,7,4)" /-->

           </xsl:variable>

           <xsl:variable name="hh">

              <xsl:value-of select="substring($timestr,1,2)" />

           </xsl:variable>

           <xsl:variable name="MM">

              <xsl:value-of select="substring($timestr,4,2)" />

           </xsl:variable>

           <xsl:variable name="ss">

              <xsl:value-of select="substring($timestr,7,2)" />

           </xsl:variable>

           <xsl:value-of select="concat($yyyy,'-',$mm,'-',$dd,'T',$hh,':',$MM,':',$ss)" />

        </xsl:template>

      </xsl:stylesheet>

       

      Output:2019-6-9T12:32:34

      but in oracle database inserted value:2019-06-09T00:00:00.000+05.30

       

      Case2:

                 Input:imp1:TimeStamp--->06/09/2019 12:32:34 AM

       

                 Output:2019-06-09T12:32:34

      In oracle database inserted value:2019-06-09T12:32:34.000+05.30

       

      Question here why in DB timestamp  discarded while date format is m/d/yyyy even though it recognized date part  ?

       

      Thanks for your reply.