2006-08-31 12:39:08

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:date-format element declares a date format, which controls the interpretation of a format pattern used by the date:format-date and date:parse-date functions.

Unimplemented (actually unused by afore mentioned functions).

INTERNAL: representation of an exact point on a timeline.

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C: def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
...

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C: def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
...

Returns the offset from UTC in minutes.

- ('year', 'month', 'day', 'hour', 'minute', 'second', 'timezone')
- {'date': <_sre.SRE_Pattern object>, 'dateTime': <_sre.SRE_Pattern object>, 'gDay': <_sre.SRE_Pattern object>, 'gMonth': <_sre.SRE_Pattern object>, 'gMonthDay': <_sre.SRE_Pattern object>, 'gYear': <_sre.SRE_Pattern object>, 'gYearMonth': <_sre.SRE_Pattern object>, 'time': <_sre.SRE_Pattern object>}
- <member 'day' of '_DateTime' objects>
- <member 'hour' of '_DateTime' objects>
- <member 'minute' of '_DateTime' objects>
- <member 'month' of '_DateTime' objects>
- {'day': '(?P<day>[0-9]{2})', 'hour': '(?P<hour>[0-9]{2})', 'minute': '(?P<minute>[0-9]{2})', 'month': '(?P<month>[0-9]{2})', 'second': '(?P<second>[0-9]{2}(?:[.][0-9]+)?)', 'timezone': '(?P<timezone>Z|[-+][0-9]{2}:[0-9]{2})', 'year': '(?P<year>[-]?[0-9]{4,})'}
- <member 'second' of '_DateTime' objects>
- <member 'timezone' of '_DateTime' objects>
- <member 'year' of '_DateTime' objects>

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C: def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
...
- ('negative', 'years', 'months', 'days', 'hours', 'minutes', 'seconds')
- <member 'days' of '_Duration' objects>
- <member 'hours' of '_Duration' objects>
- <member 'minutes' of '_Duration' objects>
- <member 'months' of '_Duration' objects>
- <member 'negative' of '_Duration' objects>
- <_sre.SRE_Pattern object>
- <member 'seconds' of '_Duration' objects>
- <member 'years' of '_Duration' objects>

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

Implements version 2.

The date:add-duration function returns the duration resulting from adding two durations together.

Implements version 2.

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.

Implements version 2.

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

Implements version 1.

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

Implements version 2.

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

Implements version 2.

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

Implements version 2.

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

Implements version 2.

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

Implements version 2.

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).

Implements version 2.

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

Implements version 1.

The date:duration function returns a duration string representing the number of seconds specified by the argument string. If no argument is given, then the result of calling date:seconds without any arguments is used as a default argument.

Implements version 1.

The date:format-date function formats a date/time according to a pattern.

The first argument to date:format-date specifies the date/time to be formatted. It must be right or left-truncated date/time strings in one of the formats defined in XML Schema Part 2: Datatypes. The permitted formats are as follows: xs:dateTime, xs:date, xs:time, xs:gYearMonth, xs:gYear, xs:gMonthDay, xs:gMonth and xs:gDay.

The second argument is a string that gives the format pattern used to format the date. The format pattern must be in the syntax specified by the JDK 1.1 SimpleDateFormat class. The format pattern string is interpreted as described for the JDK 1.1 SimpleDateFormat class.

Implements version 2.

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

Implements version 2.

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

Implements version 1.

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

Implements version 2.

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

Implements version 2.

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

Implements version 2.

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

Implements version 2.

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

Implements version 2.

The date:seconds function returns the number of seconds specified by the argument string. If no argument is given, then the current local date/time, as returned by date:date-time is used as a default argument.

Implements version 1.

The date:sum function adds a set of durations together. The string values of the nodes in the node set passed as an argument are interpreted as durations and added together as if using the date:add-duration function.

Implements version 1.

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.

Implements version 2.

The date:week-in-month function returns the week in a month of a date as a number. If no argument is given, then the current local date/time, as returned by date:date-time is used the default argument. For the purposes of numbering, the first day of the month is in week 1 and new weeks begin on a Monday (so the first and last weeks in a month will often have less than 7 days in them).

Implements version 3.

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

Implements version 3.

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

Implements version 2.

INTERNAL: returns a new duration from the sum of the sequence of durations

INTERNAL: converts an XPath object to a _DateTime instance.

INTERNAL: calculates the ordinal date for the given date.

INTERNAL: calculates the day of week (0=Sun, 6=Sat) for the given date.

INTERNAL: calculates the number of days in a month for the given date.

INTERNAL: subtracts the end date from the start date.

INTERNAL: calculates the Julian day (1-1-1 is day 1) for the given date.

'http://exslt.org/dates-and-times'
{}
{('http://exslt.org/dates-and-times', 'add'): <function Add>, ('http://exslt.org/dates-and-times', 'add-duration'): <function AddDuration>, ('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': 'date'}