views:

567

answers:

4

HI all, I got a JavaScript function to convert the date, but I was wondering if there is any way to convert the date with xsl without using JavaScript.

Thanks.

+1  A: 

the format-date function might do the job, have a look at it here:

http://www.w3.org/TR/xslt20/#function-format-date

John Boker
+1  A: 

and the string manipulation, http://www.xml.com/pub/a/2002/05/01/xslt-string.html

Dyno Fu
+1  A: 

You can use the Microsoft formatter: http://msdn.microsoft.com/en-us/library/ms256099.aspx

or if you are using XSLT 2.0 (which .Net does not) http://www.w3.org/TR/xslt20/#function-format-date

jjacka
A: 

Hi guys, Thanks to all of you for answering my question, after looking on those links you left me to take a look I came out with something very simple.

<xsl:for-each select="//MaternityDiaryEvent/DateOfVisit">
<xsl:value-of select="concat(substring(.,9,2),'/',substring(.,6,2),'/',substring(.,3,2))"/>
</xsl:for-each>

Thanks again to all, I'll give you a vote to each of you.

Cesar.

Cesar Lopez
why not post it out? :)
Dyno Fu
Sorry The code was not showing.
Cesar Lopez