在XSLT中格式化日期和时间 [英] Format Date and Time in XSLT
本文介绍了在XSLT中格式化日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一列以默认格式返回日期和时间.
I have the column which returns the date and time in the default format.
<xsl:value-of select="/CAudioFile/CRI/LocalStartTime"/>
哪个返回
2014-05-08T08:01:26.4000000-0700
2014-05-08T08:01:26.4000000-0700
我希望这次使用以下格式:
I want to put this time in this format:
2014年5月8日08:01:26
我尝试使用子字符串的不同组合获取格式:
I have tried to get the format with the different combination of substring:
<xsl:value-of select="substring(/CAudioFile/CRI/LocalStartTime,1,10)"/>
但这只是返回日期或时间给我.
But it's either returning me just the date or just the time.
有什么建议吗?
谢谢.
推荐答案
您需要为此付出更多努力:
You need to work a bit harder at it:
<xsl:value-of select="substring(CAudioFile/CRI/LocalStartTime, 6, 2)"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="substring(CAudioFile/CRI/LocalStartTime, 9, 2)"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="substring(CAudioFile/CRI/LocalStartTime, 1, 4)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="substring(CAudioFile/CRI/LocalStartTime, 12, 8)"/>
这篇关于在XSLT中格式化日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文