2003-09-16 00:09:57

Implementation of EXSLT Dates and Times module

Copyright 2003 Fourthought, Inc. (USA). Detailed license and copyright information: http://4suite.org/COPYRIGHT Project home, documentation, distributions: http://4suite.org/

The date:add function returns the result of adding a duration to a dateTime.

The date:date function returns the date portion of the dateTime argument if present, or of the current local date/time. The argument can be given in xs:dateTime or xs:date format.

Non-conformance issues: The dateTime argument must be given in ISO 8601 date/time or date format, so an xs:date format with a time zone is not supported. Also, EXSLT requires that the result must include a time zone unless there was an argument given and it did not have a time zone. If a date/time argument is given, this implementation returns the date with no time zone info.

The date:date-time function returns the current local date/time as an ISO 8601 formatted date/time string, with a time zone.

The date:day-abbreviation function returns the English abbreviation for the day name of a given date.

The date:day-in-month function returns the numerical date, i.e. 27 for the 27th of March.

The date:day-in-week function returns a number representing the weekday of a given date. Sunday is 1, Saturday is 7.

The date:day-in-year function returns a number representing the position of a date in the year.

The date:day-name function returns the full English day name of a given date.

The date:day-of-week-in-month function returns the day-of-the-week in a month of a date as a number (e.g. 3 for the 3rd Tuesday in May).

The date:difference function returns the difference between dt1 and dt2 as a duration in string form.

According to the spec (http://exslt.org/date/functions/difference/index.html)

"If the date/time string with the least specific format is in either xs:gYearMonth or xs:gYear format, then the number of days, hours, minutes and seconds in the duration string must be equal to zero. (The format of the string will be PnYnM.) The number of months specified in the duration must be less than 12."

"Otherwise, the number of years and months in the duration string must be equal to zero. (The format of the string will be PnDTnHnMnS.) The number of seconds specified in the duration string must be less than 60; the number of minutes must be less than 60; the number of hours must be less than 24."

This method does not account for leap seconds, so you should not expect precise results over long time spans.

The date:hour-in-date function returns the hour portion of a date- time string as an integer.

The date:leap-year function returns true if the year argument (defaults to current year) is a leap year, false otherwise.

The date:minute-in-hour function returns the minute portion of a date-time string as an integer.

The date:month-abbreviation function returns the abbreviation of the month of a date.

The date:month-in-year function returns the month portion of the dateTime argument (defaults to current year) as an integer.

The date:month-name function returns the full English name of the month portion of a date.

The date:second-in-minute function returns the seconds portion of a date-time string as an integer.

The date:time function returns the time portion of the dateTime argument if present, or of the current local date/time. The argument can be given in xs:dateTime or xs:time format.

Non-conformance issue: EXSLT requires that the result must include a time zone unless there was an argument given and it did not have a time zone. If an argument is given, this implementation returns the result with time zone info, always.

The date:week-in-year function returns a number representing the week of the year a date is in.

The date:year function returns the year portion of the dateTime supplied, or of the current year, as an integer.

## Utility functions for internal use

'http://exslt.org/dates-and-times'
{}
{('http://exslt.org/dates-and-times', 'add'): <function Add>, ('http://exslt.org/dates-and-times', 'date'): <function Date>, ('http://exslt.org/dates-and-times', 'date-time'): <function DateTime>, ('http://exslt.org/dates-and-times', 'day-abbreviation'): <function DayAbbreviation>, ('http://exslt.org/dates-and-times', 'day-in-month'): <function DayInMonth>, ('http://exslt.org/dates-and-times', 'day-in-week'): <function DayInWeek>, ('http://exslt.org/dates-and-times', 'day-in-year'): <function DayInYear>, ('http://exslt.org/dates-and-times', 'day-name'): <function DayName>, ('http://exslt.org/dates-and-times', 'day-of-week-in-month'): <function DayOfWeekInMonth>, ('http://exslt.org/dates-and-times', 'difference'): <function Difference>, ...}
{'http://exslt.org/dates-and-times': 'date'}
'%Y-%m-%d'
'%Y-%m-%dT%H:%M:%S'
'%H:%M:%S'

Compiled regular expression objects

<_sre.SRE_Pattern object>