home contribute faq download

FunctX XQuery Functions

functx:last-day-of-month

The last day of the month of a date

Google
Webdatypic.com

Description

The functx:last-day-of-month function returns the date representing the last day of the month 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?

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:last-day-of-month
  ( $date as xs:anyAtomicType? )  as xs:date? {

   functx:date(year-from-date(xs:date($date)),
            month-from-date(xs:date($date)),
            functx:days-in-month($date))
 } ;

Examples

XQuery ExampleResults
functx:last-day-of-month(xs:date('2004-01-23'))
2004-01-31
functx:last-day-of-month(
     xs:dateTime('2004-09-23T12:00:13'))
2004-09-30
functx:last-day-of-month('2004-03-23')
2004-03-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:days-in-monthNumber of days in the month
functx:first-day-of-monthThe first day of the month of a date
functx:last-day-of-yearThe 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
Datypic XQuery Services

Recommended Reading:

XQuery