RE: [xsl] Date format

Subject: RE: [xsl] Date format
From: "Ali Mutlu" <alimutlu@xxxxxxxxxxxx>
Date: Thu, 30 May 2002 16:15:36 +0300
>> I have a date 17-MAY-02 from the oracle database that I would like to
>> format as YYYYMMDDHR24MI and another date 117-MAY-02 to be converted to

>> I wish to do the transformation in the XSLT. Has anyone done this before
>> and if so how did you do it?


The following template translates anything like dd-mmm-yyyy to yyyymmdd, I
beleive a shorter way may exists, but it works


<xsl:template name="ConvertRtDate">
	<xsl:param name="ADate"/>
		<xsl:value-of select="substring($ADate,8,4)"/>
			<xsl:when test="substring($ADate,4,3)='JAN'">
				<xsl:value-of select="'01'"/>
			<xsl:when test="substring($ADate,4,3)='FEB'">
				<xsl:value-of select="'02'"/>
			<xsl:when test="substring($ADate,4,3)='MAR'">
				<xsl:value-of select="'03'"/>
			<xsl:when test="substring($ADate,4,3)='APR'">
				<xsl:value-of select="'04'"/>
			<xsl:when test="substring($ADate,4,3)='MAY'">
				<xsl:value-of select="'05'"/>
			<xsl:when test="substring($ADate,4,3)='JUN'">
				<xsl:value-of select="'06'"/>
			<xsl:when test="substring($ADate,4,3)='JUL'">
				<xsl:value-of select="'07'"/>
			<xsl:when test="substring($ADate,4,3)='AUG'">
				<xsl:value-of select="'08'"/>
			<xsl:when test="substring($ADate,4,3)='SEP'">
				<xsl:value-of select="'09'"/>
			<xsl:when test="substring($ADate,4,3)='OCT'">
				<xsl:value-of select="'10'"/>
			<xsl:when test="substring($ADate,4,3)='NOV'">
				<xsl:value-of select="'11'"/>
			<xsl:when test="substring($ADate,4,3)='DEC'">
				<xsl:value-of select="'12'"/>
	<xsl:value-of select="substring($ADate,1,2)"/>

 XSL-List info and archive:

Current Thread