org.apache.xalan.lib
Class ExsltDatetime
public
class
ExsltDatetime
extends Object
This class contains EXSLT dates and times extension functions.
It is accessed by specifying a namespace URI as follows:
xmlns:datetime="http://exslt.org/dates-and-times"
The documentation for each function has been copied from the relevant
EXSLT Implementer page.
See Also: EXSLT
UNKNOWN: general
Method Summary |
static String | date(String datetimeIn)
The date:date function returns the date specified in the date/time string given
as the argument. |
static String | date()
See above. |
static String | dateTime()
The date:date-time function returns the current date and time as a date/time string.
|
static String | dayAbbreviation(String datetimeIn)
The date:day-abbreviation function returns the abbreviation of the day
of the week of a date. |
static String | dayAbbreviation()
See above. |
static double | dayInMonth(String datetimeIn)
The date:day-in-month function returns the day of a date as a number.
|
static double | dayInMonth()
See above. |
static double | dayInWeek(String datetimeIn)
The date:day-in-week function returns the day of the week given in a
date as a number. |
static double | dayInWeek()
See above. |
static double | dayInYear(String datetimeIn)
The date:day-in-year function returns the day of a date in a year
as a number. |
static double | dayInYear()
See above. |
static String | dayName(String datetimeIn)
The date:day-name function returns the full name of the day of the week
of a date. |
static String | dayName()
See above. |
static double | dayOfWeekInMonth(String datetimeIn)
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. |
static double | dayOfWeekInMonth()
See above. |
static String | formatDate(String dateTime, String pattern)
The date:format-date function formats a date/time according to a pattern.
|
static double | hourInDay(String datetimeIn)
The date:hour-in-day function returns the hour of the day as a number.
|
static double | hourInDay()
See above. |
static XObject | leapYear(String datetimeIn)
The date:leap-year function returns true if the year given in a date
is a leap year. |
static boolean | leapYear()
See above. |
static double | minuteInHour(String datetimeIn)
The date:minute-in-hour function returns the minute of the hour
as a number. |
static double | minuteInHour()
See above. |
static String | monthAbbreviation(String datetimeIn)
The date:month-abbreviation function returns the abbreviation of the month of
a date. |
static String | monthAbbreviation()
See above. |
static double | monthInYear(String datetimeIn)
The date:month-in-year function returns the month of a date as a number. |
static double | monthInYear()
See above. |
static String | monthName(String datetimeIn)
The date:month-name function returns the full name of the month of a date.
|
static String | monthName()
See above. |
static double | secondInMinute(String datetimeIn)
The date:second-in-minute function returns the second of the minute
as a number. |
static double | secondInMinute()
See above. |
static String | time(String timeIn)
The date:time function returns the time specified in the date/time string given
as the argument. |
static String | time()
See above. |
static double | weekInYear(String datetimeIn)
The date:week-in-year function returns the week of the year as a number. |
static double | weekInYear()
See above. |
static double | year(String datetimeIn)
The date:year function returns the year of a date as a number. |
static double | year()
See above. |
public static String date(String datetimeIn)
The date:date function returns the date specified in the date/time string given
as the argument. If no argument is given, then the current local date/time, as
returned by date:date-time is used as a default argument.
The date/time string that's returned must be a string in the format defined as the
lexical representation of xs:dateTime in
[3.2.7 dateTime] of
[XML Schema Part 2: Datatypes].
If the argument is not in either of these formats, date:date returns an empty string ('').
The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult
[XML Schema Part 2: Datatypes] and
[ISO 8601] for details.
The date is returned as a string with a lexical representation as defined for xs:date in
[3.2.9 date] of [XML Schema Part 2: Datatypes]. The date format is basically CCYY-MM-DD,
although implementers should consult [XML Schema Part 2: Datatypes] and [ISO 8601] for details.
If no argument is given or the argument date/time specifies a time zone, then the date string
format must include a time zone, either a Z to indicate Coordinated Universal Time or a + or -
followed by the difference between the difference from UTC represented as hh:mm. If an argument
is specified and it does not specify a time zone, then the date string format must not include
a time zone.
public static String date()
See above.
public static String dateTime()
The date:date-time function returns the current date and time as a date/time string.
The date/time string that's returned must be a string in the format defined as the
lexical representation of xs:dateTime in
[3.2.7 dateTime] of
[XML Schema Part 2: Datatypes].
The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult
[XML Schema Part 2: Datatypes] and
[ISO 8601] for details.
The date/time string format must include a time zone, either a Z to indicate Coordinated
Universal Time or a + or - followed by the difference between the difference from UTC
represented as hh:mm.
public static String dayAbbreviation(String datetimeIn)
The date:day-abbreviation function returns the abbreviation of the day
of the week of a date. If no argument is given, then the current local
date/time, as returned by date:date-time is used the default argument.
The date/time string specified as the argument is a left or right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
If the date/time string is not in one of these formats, then the empty string
('') is returned.
The result is a three-letter English day abbreviation: one of 'Sun', 'Mon', 'Tue',
'Wed', 'Thu' or 'Fri'.
An implementation of this extension function in the EXSLT date namespace must conform
to the behaviour described in this document.
public static String dayAbbreviation()
See above.
public static double dayInMonth(String datetimeIn)
The date:day-in-month function returns the day 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.
The date/time string specified as the argument is a left or right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gMonthDay (--MM-DD)
xs:gDay (---DD)
If the date/time string is not in one of these formats, then NaN is returned.
public static double dayInMonth()
See above.
public static double dayInWeek(String datetimeIn)
The date:day-in-week function returns the day of the week given in 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.
The date/time string specified as the argument is a right-truncated string
in the format defined as the lexical representation of xs:dateTime in one
of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
If the date/time string is not in one of these formats, then NaN is returned.
The numbering of days of the week starts at 1 for Sunday, 2 for Monday and so on up to 7 for Saturday.
public static double dayInWeek()
See above.
public static double dayInYear(String datetimeIn)
The date:day-in-year function returns the day of a date in a year
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.
The date/time string specified as the argument is a right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
If the date/time string is not in one of these formats, then NaN is returned.
public static double dayInYear()
See above.
public static String dayName(String datetimeIn)
The date:day-name function returns the full name of the day of the week
of a date. If no argument is given, then the current local date/time,
as returned by date:date-time is used the default argument.
The date/time string specified as the argument is a left or right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
If the date/time string is not in one of these formats, then the empty string ('')
is returned.
The result is an English day name: one of 'Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday' or 'Friday'.
An implementation of this extension function in the EXSLT date namespace must conform
to the behaviour described in this document.
public static String dayName()
See above.
public static double dayOfWeekInMonth(String datetimeIn)
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).
If no argument is given, then the current local date/time, as returned
by date:date-time is used the default argument.
The date/time string specified as the argument is a right-truncated string
in the format defined as the lexical representation of xs:dateTime in one
of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
If the date/time string is not in one of these formats, then NaN is returned.
public static double dayOfWeekInMonth()
See above.
public static String formatDate(String dateTime, String 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 (CCYY-MM-DDThh:mm:ss)
- xs:date (CCYY-MM-DD)
- xs:time (hh:mm:ss)
- xs:gYearMonth (CCYY-MM)
- xs:gYear (CCYY)
- xs:gMonthDay (--MM-DD)
- xs:gMonth (--MM--)
- xs:gDay (---DD)
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.
If the date/time format is right-truncated (i.e. in a format other than
xs:time, or xs:dateTime) then any missing components are assumed to be as
follows: if no month is specified, it is given a month of 01; if no day
is specified, it is given a day of 01; if no time is specified, it is
given a time of 00:00:00.
If the date/time format is left-truncated (i.e. xs:time, xs:gMonthDay,
xs:gMonth or xs:gDay) and the format pattern has a token that uses a
component that is missing from the date/time format used, then that token
is replaced with an empty string ('') within the result.
The author is Helg Bredow (helg.bredow@kalido.com)
public static double hourInDay(String datetimeIn)
The date:hour-in-day function returns the hour of the day 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.
The date/time string specified as the argument is a right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:time (hh:mm:ss)
If the date/time string is not in one of these formats, then NaN is returned.
public static double hourInDay()
See above.
public static
XObject leapYear(String datetimeIn)
The date:leap-year function returns true if the year given in a date
is a leap year. If no argument is given, then the current local
date/time, as returned by date:date-time is used as a default argument.
The date/time string specified as the first argument must be a
right-truncated string in the format defined as the lexical representation
of xs:dateTime in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gYearMonth (CCYY-MM)
xs:gYear (CCYY)
If the date/time string is not in one of these formats, then NaN is returned.
public static boolean leapYear()
See above.
public static double minuteInHour(String datetimeIn)
The date:minute-in-hour function returns the minute of the hour
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.
The date/time string specified as the argument is a right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:time (hh:mm:ss)
If the date/time string is not in one of these formats, then NaN is returned.
public static double minuteInHour()
See above.
public static String monthAbbreviation(String datetimeIn)
The date:month-abbreviation function returns the abbreviation of the month of
a date. If no argument is given, then the current local date/time, as returned
by date:date-time is used the default argument.
The date/time string specified as the argument is a left or right-truncated
string in the format defined as the lexical representation of xs:dateTime in
one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gYearMonth (CCYY-MM)
xs:gMonth (--MM--)
If the date/time string is not in one of these formats, then an empty string ('')
is returned.
The result is a three-letter English month abbreviation: one of 'Jan', 'Feb', 'Mar',
'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov' or 'Dec'.
An implementation of this extension function in the EXSLT date namespace must conform
to the behaviour described in this document.
public static String monthAbbreviation()
See above.
public static double monthInYear(String datetimeIn)
The date:month-in-year function returns the 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
as a default argument.
The date/time string specified as the first argument is a left or right-truncated
string in the format defined as the lexical representation of xs:dateTime in one of
the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gYearMonth (CCYY-MM)
xs:gMonth (--MM--)
xs:gMonthDay (--MM-DD)
If the date/time string is not in one of these formats, then NaN is returned.
public static double monthInYear()
See above.
public static String monthName(String datetimeIn)
The date:month-name function returns the full name of the month of a date.
If no argument is given, then the current local date/time, as returned by
date:date-time is used the default argument.
The date/time string specified as the argument is a left or right-truncated
string in the format defined as the lexical representation of xs:dateTime in
one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gYearMonth (CCYY-MM)
xs:gMonth (--MM--)
If the date/time string is not in one of these formats, then an empty string ('')
is returned.
The result is an English month name: one of 'January', 'February', 'March',
'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November'
or 'December'.
public static String monthName()
See above.
public static double secondInMinute(String datetimeIn)
The date:second-in-minute function returns the second of the minute
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.
The date/time string specified as the argument is a right-truncated
string in the format defined as the lexical representation of xs:dateTime
in one of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:time (hh:mm:ss)
If the date/time string is not in one of these formats, then NaN is returned.
public static double secondInMinute()
See above.
public static String time(String timeIn)
The date:time function returns the time specified in the date/time string given
as the argument. If no argument is given, then the current local date/time, as
returned by date:date-time is used as a default argument.
The date/time string that's returned must be a string in the format defined as the
lexical representation of xs:dateTime in
[3.2.7 dateTime] of
[XML Schema Part 2: Datatypes].
If the argument string is not in this format, date:time returns an empty string ('').
The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult
[XML Schema Part 2: Datatypes] and
[ISO 8601] for details.
The date is returned as a string with a lexical representation as defined for xs:time in
[3.2.8 time] of [XML Schema Part 2: Datatypes].
The time format is basically hh:mm:ss, although implementers should consult [XML Schema Part 2:
Datatypes] and [ISO 8601] for details.
If no argument is given or the argument date/time specifies a time zone, then the time string
format must include a time zone, either a Z to indicate Coordinated Universal Time or a + or -
followed by the difference between the difference from UTC represented as hh:mm. If an argument
is specified and it does not specify a time zone, then the time string format must not include
a time zone.
public static String time()
See above.
public static double weekInYear(String datetimeIn)
The date:week-in-year function returns the week of the year as a number. If no argument
is given, then the current local date/time, as returned by date:date-time is used as the
default argument. For the purposes of numbering, counting follows ISO 8601: week 1 in a year
is the week containing the first Thursday of the year, with new weeks beginning on a Monday.
The date/time string specified as the argument is a right-truncated string in the format
defined as the lexical representation of xs:dateTime in one of the formats defined in
[XML Schema Part 2: Datatypes]. The
permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
If the date/time string is not in one of these formats, then NaN is returned.
public static double weekInYear()
See above.
public static double year(String datetimeIn)
The date:year function returns the year 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 as a default argument.
The date/time string specified as the first argument must be a right-truncated
string in the format defined as the lexical representation of xs:dateTime in one
of the formats defined in
[XML Schema Part 2: Datatypes].
The permitted formats are as follows:
xs:dateTime (CCYY-MM-DDThh:mm:ss)
xs:date (CCYY-MM-DD)
xs:gYearMonth (CCYY-MM)
xs:gYear (CCYY)
If the date/time string is not in one of these formats, then NaN is returned.
public static double year()
See above.
Copyright B) 2006 Apache XML Project. All Rights Reserved.