2010-05-19 68 views
0

我有一个来自SQL的日期2010-05-11 10:30:00但是,当我applyc XSL它添加2010-05-11T10:30:00-04:00时区偏移量。有什么办法可以将它从XSL中移除。XML时区删除

+0

您使用什么功能来格式化日期? – 2010-05-19 14:04:44

+0

如果您提供了一个输入示例,它会更容易一些。 – oluies 2010-05-19 22:20:53

回答

1

使用子串格式?

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output method="xml" /> 
    <xsl:template match="*"> 
      <xsl:copy> 
       <xsl:for-each select="@*"> 
        <xsl:copy-of select="." /> 
       </xsl:for-each> 
       <xsl:apply-templates /> 
      </xsl:copy> 
    </xsl:template> 
    <xsl:template match="MyMessage/DateField"> 
      <xsl:copy> 
       <xsl:value-of select="substring(.,1,4)"/> 
       <xsl:text>-</xsl:text> 
       <xsl:value-of select="substring(.,5,2)"/> 
       <xsl:text>-</xsl:text> 
       <xsl:value-of select="substring(.,7,2)"/> 
      </xsl:copy> 
    </xsl:template> 
</xsl:stylesheet>