[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Q on ISO TimeDate convertion
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|