home contribute faq download

FunctX XSLT Functions

functx:previous-day

The previous day

Google
Webxsltfunctions.com

Description

The functx:previous-day function takes a date and returns a date representing the previous day.

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.
<xsl:function name="functx:previous-day" as="xs:date?"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="date" as="xs:anyAtomicType?"/>

  <xsl:sequence select="
   xs:date($date) - xs:dayTimeDuration('P1D')
 "/>

</xsl:function>

Examples

XPath ExampleResults
functx:previous-day(xs:date('2004-01-23'))
2004-01-22
functx:previous-day(
     xs:dateTime('2005-01-01T12:00:13'))
2004-12-31

See Also

functx:next-dayThe next day

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery