4Suite API Documentation: Ft.Xml.Xslt.Exslt.DateTime

4Suite™ API Documentation

# ► Module Ft.Xml.Xslt.Exslt.DateTime

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/

Classes: DateFormatElement |  |  |  | Functions: Add, AddDuration, Date, DateTime, DayAbbreviation, DayInMonth, DayInWeek, DayInYear, DayName, DayOfWeekInMonth, Difference, Duration, FormatDate, HourInDay, LeapYear, MinuteInHour, MonthAbbreviation, MonthInYear, MonthName, ParseDate, SecondInMinute, Seconds, Sum, Time, WeekInMonth, WeekInYear, Year |  |  |  | Globals: EXSL_DATE_TIME_NS, ExtElements, ExtFunctions, ExtNamespaces

## Classes

class DateFormatElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)
  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).

  ### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

  __init__, __str__, appendChild, expandQName, insertChild, instantiate, parseAVT, parseExpression, parsePattern, processChildren, splitQName

  ### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

  idle, isLastChild, isPseudoNode, pprint, prime, setup

  ### Members inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

  category, content, legalAttrs, validator

  ### Members inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

  attributes, baseUri, children, columnNumber, doesIdle, doesPrime, doesSetup, expandedName, importIndex, lineNumber, nodeName, parent, root

## Functions

Add(context, dateTime, duration)
  The date:add function returns the result of adding a duration to a dateTime.

      Implements version 2.

AddDuration(context, duration1, duration2)
  The date:add-duration function returns the duration resulting from adding two durations together.

      Implements version 2.

Date(context, dateTime=None)
  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.

DateTime(context)
  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.

DayAbbreviation(context, dateTime=None)
  The date:day-abbreviation function returns the English abbreviation for the day name of a given date.

      Implements version 2.

DayInMonth(context, dateTime=None)
  The date:day-in-month function returns the numerical date, i.e. 27 for the 27th of March.

      Implements version 2.

DayInWeek(context, dateTime=None)
  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.

DayInYear(context, dateTime=None)
  The date:day-in-year function returns a number representing the position of a date in the year.

      Implements version 2.

DayName(context, dateTime=None)
  The date:day-name function returns the full English day name of a given date.

      Implements version 2.

DayOfWeekInMonth(context, dateTime=None)
  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.

Difference(context, start, end)
  The date:difference function returns the difference between the first date and the second date as a duration in string form.

      Implements version 1.

Duration(context, seconds=None)
  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.

FormatDate(context, dateTime, pattern)
  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.

HourInDay(context, dateTime=None)
  The date:hour-in-date function returns the hour portion of a date- time string as an integer.

      Implements version 2.

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

      Implements version 1.

MinuteInHour(context, dateTime=None)
  The date:minute-in-hour function returns the minute portion of a date-time string as an integer.

      Implements version 2.

MonthAbbreviation(context, dateTime=None)
  The date:month-abbreviation function returns the abbreviation of the month of a date.

      Implements version 2.

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

      Implements version 2.

MonthName(context, dateTime=None)
  The date:month-name function returns the full English name of the month portion of a date.

      Implements version 2.

ParseDate(context, dateString, pattern)
SecondInMinute(context, dateTime=None)
  The date:second-in-minute function returns the seconds portion of a date-time string as an integer.

      Implements version 2.

Seconds(context, string=None)
  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.

Sum(context, nodeset)
  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.

Time(context, dateTime=None)
  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.

WeekInMonth(context, dateTime=None)
  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.

WeekInYear(context, dateTime=None)
  The date:week-in-year function returns a number representing the week of the year a date is in.

      Implements version 3.

Year(context, dateTime=None)
  The date:year function returns the year portion of the dateTime supplied, or of the current year, as an integer.

      Implements version 2.

## Globals

EXSL_DATE_TIME_NS = 'http://exslt.org/dates-and-times'
ExtElements = {}
ExtFunctions = {('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>, ...}
ExtNamespaces = {'http://exslt.org/dates-and-times': 'date'}