Description
The functx:days-in-month function returns the number of days in the month of $date as an integer.
The $date argument must be castable to xs:date, meaning that it must have the type xs:date or xs:dateTime, or be an xs:string or untyped value of the form YYYY-MM-DD.
Arguments and Return Type| Name | Type | Description |
$date |
xs:anyAtomicType? |
the date |
| return value |
xs:integer? |
XSLT Function Declaration| See XQuery definition. | | XSLT 2.0 Syntax: |
|---|
<xsl:function name="functx:days-in-month" as="xs:integer?"
xmlns:functx="http://www.functx.com" >
<xsl:param name="date" as="xs:anyAtomicType?"/>
<xsl:sequence select="
if (month-from-date(xs:date($date)) = 2 and
functx:is-leap-year($date))
then 29
else
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
[month-from-date(xs:date($date))]
"/>
</xsl:function>
|
Examples| XSLT Example | Results |
|---|
functx:days-in-month(xs:date('2004-01-23'))
|
31
|
functx:days-in-month(
xs:dateTime('2004-02-15T12:00:13'))
|
29
|
functx:days-in-month('2005-02-15')
|
28
|
Depends OnSee AlsoHistory |
|