This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Q on ISO TimeDate convertion
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Q on ISO TimeDate convertion
- From: "Walter Torres" <walter at torres dot ws>
- Date: Wed, 7 Nov 2001 19:48:01 -0600
- Reply-To: xsl-list at lists dot mulberrytech dot com
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
My problem is that I really don't know how to convert the Time part to an
AM/PM format, not just the 24 hour clock it is now.
Below is the code I am using to convert the date.
Can someone help with the Time conversion.
Also, is there a way to pass the ISO Date/Time and return the conversion,
just a function?
The Template I have does the conversion and the display all within the
Template.
Walter
<!-- timestamp NODE Template -->
<xsl:template match="timestamp">
<!-- Pull the pieces apart -->
<xsl:variable name="datetime" select="."/>
<xsl:variable name="year" select="substring( $datetime, 0 , 5 )"/>
<xsl:variable name="month" select="substring( $datetime, 6 , 2 )"/>
<xsl:variable name="day" select="substring( $datetime, 9 , 2 )"/>
<td valign="top" class='data'>
<!-- put the date together in American order -->
<xsl:value-of select="concat($month, '/', $day, '/', $year )"/>
<!-- Seperate the date and Time -->
-
<!-- Display the Time -->
<xsl:value-of select="substring( $datetime, 12 , 5 )"/>
</td>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list