home contribute faq download

FunctX XSLT Functions

functx:last-day-of-year

The last day of the month of a date

Google
Webxsltfunctions.com

Description

The functx:last-day-of-year function returns the date representing the last day of the year of $date as an xs:date value.

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

NameTypeDescription
$date xs:anyAtomicType? the date
return value xs:date?

XSLT Function Declaration

See XQuery definition.
XSLT 2.0 Syntax:
<xsl:function name="functx:last-day-of-year" as="xs:date?" 
              xmlns:functx="http://www.functx.com" >
  <xsl:param name="date" as="xs:anyAtomicType?"/> 
 
  <xsl:sequence select=" 
   functx:date(year-from-date(xs:date($date)), 12, 31)
 "/>
   
</xsl:function>

Examples

XSLT ExampleResults
functx:last-day-of-year(xs:date('2004-01-23'))
2004-12-31
functx:last-day-of-year(
     xs:dateTime('2004-12-23T12:00:13'))
2004-12-31
functx:last-day-of-year('2004-03-23')
2004-12-31

Depends On

functx:dateConstruct a date from a year, month and day
functx:days-in-monthNumber of days in the month

See Also

functx:first-day-of-yearThe first day of the year of a date
functx:last-day-of-monthThe last day of the month of a date

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Need XSLT Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley