segunda-feira, 19 de maio de 2008

XSL formatar data no formato DD/MM

Olá Amigos,

Corrigindo este POST =]

Abaixo vocês vão ver toda uma choradeira de minha parte e uma baita gambiarra.
Porém existe um forma elegante sim de resolver este problema.

É essa:

<xsl:value-of select="ddwrt:FormatDateTime(string(@Data),1046,'dd/MM')"/>

Abaixo uma pequena gambiarra criada por mim para exibir a data no formato DD/MM, tive que fazer isto, pois a função nativa do SharePoint (ddwrt:FormatDate) não oferece este formato.

Abraços,
Leonardo

<xsl:choose>
<xsl:when test="number(substring-before(@_DCDateCreated,'/')) <= 9">0<xsl:value-of select="substring-before(@_DCDateCreated,'/')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="substring-before(@_DCDateCreated,'/')"/></xsl:otherwise>
</xsl:choose>
/
<xsl:choose>
<xsl:when test="number(substring-before(substring-after(@_DCDateCreated,'/'),'/')) <= 9">0<xsl:value-of select="substring-before(substring-after(@_DCDateCreated,'/'),'/')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="substring-before(substring-after(@_DCDateCreated,'/'),'/')"/></xsl:otherwise>
</xsl:choose>

Nenhum comentário: