我正在尝试根据从 4 月 6 日开始的一年来计算一年。
使用 EXSLT,我可以根据正常的 1 月开始计算年份:
date:formatDate(date:add(date:date(), '-P6Y'), 'yyyy')
除了从 4 月 6 日开始的一年,我怎么能这样做。
谢谢。
像这样的东西
<xsl:choose>
<xsl:when test="(date:month-in-year() = 4 and date:day-in-month() <= 6) or (date:month-in-year() < 4)">
<xsl:value-of select="date:formatDate(date:add(date:date(), '-P7Y'), 'yyyy')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="date:formatDate(date:add(date:date(), '-P6Y'), 'yyyy')" />
</xsl:otherwise>
</xsl:choose>