Reputation: 508
I have date in xml as "YYYY-MM-DD hh mm ss", need to convert that into "YYYYMMDDhhmm", can anyone help me with xslt date formatters ?
<xsl:if test="not(normalize-space(dt)) = ''">
<INVDTE>
<xsl:value-of select="normalize-space(dt)"/>
</INVDTE>
</xsl:if>
XMl:
<dt>2020-01-02-15.49.01.000001</dt>
Expected:
202001021549
Upvotes: 0
Views: 282
Reputation: 163458
Simplest way is translate(., '- ', '')
to remove the punctuation, then substring(., 1, 12)
to remove the seconds value.
Upvotes: 2