Convert time string in XSLT -
how convert time string like
20101115083000 +0200
to
2010-11-15 08:30:00 +0200
using xslt?
we use templates:
<xsl:template name="format-date-time"> <xsl:param name="date" select="'%y-%m-%dt%h:%m:%s%z'"/> <xsl:value-of select="substring($date, 9, 2)"/> <xsl:text>/</xsl:text> <xsl:value-of select="substring($date, 6, 2)"/> <xsl:text>/</xsl:text> <xsl:value-of select="substring($date, 1, 4)"/> <xsl:text> </xsl:text> <xsl:value-of select="substring($date, 12, 2)"/> <xsl:text>:</xsl:text> <xsl:value-of select="substring($date, 15, 2)"/> <xsl:text>:</xsl:text> <xsl:value-of select="substring($date, 18, 2)"/> </xsl:template>
we call these templates this:
<xsl:call-template name="format-date-time"> <xsl:with-param name="date" select="./startdate"/> </xsl:call-template>
./startdate xml date, substring technique, think solve problem too.
Comments
Post a Comment