[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Q on ISO TimeDate convertion

Subject: Re: Q on ISO TimeDate convertion
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 8 Nov 2001 09:58:27 +0000
xsl format date iso
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.
See:

  http://www.exslt.org/date/functions/format-date
  
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'" />
  </xsl:call-template>

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:choose>
    <xsl:when test="$h">
      <xsl:value-of select="format-number($h, $padding)" />
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="format-number(12, $padding)" />
    </xsl:otherwise>
  </xsl:choose>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.