Re: [xsl] Q on ISO TimeDate convertion

Subject: Re: [xsl] Q on ISO TimeDate convertion
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 8 Nov 2001 09:58:27 +0000
Hi Walter,

> I have an XSLT Template that converts the ISO TimeDate format to an
> American Standard display.
>     2001-10-18T12:27:46
>     10/18/2001 12:27:46

You could use the date/time extension functions from EXSLT to do this.
If you don't want to use an extension function, there's an equivalent
date:format-date template that you could call with:

  <xsl:call-template name="date:format-date">
    <xsl:with-param name="date-time" select="'2001-10-18T00:27:46'" />
    <xsl:with-param name="format" select="'MM/dd/yyyy hh:mm:ss a'" />

to get the formatting that you want. Or if you don't want to go the
whole hog, then looking at the code might help. The relevant part for
getting the 12-hour clock is:

  <xsl:variable name="h" select="$hour mod 12" />
    <xsl:when test="$h">
      <xsl:value-of select="format-number($h, $padding)" />
      <xsl:value-of select="format-number(12, $padding)" />



Jeni Tennison

 XSL-List info and archive:

Current Thread