public final class Date
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
add(XPathContext context,
java.lang.String datetimeIn,
java.lang.String durationIn)
The date:add function returns the date/time resulting from adding a duration to a date/time.
|
java.lang.String |
addDuration(java.lang.String duration0,
java.lang.String duration1)
The date:add-duration function returns the duration resulting from adding two durations together.
|
static java.lang.String |
date(XPathContext context)
The date:date function returns the current date.
|
static java.lang.String |
date(XPathContext context,
java.lang.String datetimeIn)
The date:date function returns the date specified in the date/time string given
as the argument.
|
static java.lang.String |
dateTime(XPathContext context)
The date:date-time function returns the current date and time as a date/time string.
|
static java.lang.String |
dayAbbreviation(XPathContext context)
Return the day of the week given in the current date as an English day abbreviation:
one of 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', or 'Sat'.
|
static java.lang.String |
dayAbbreviation(XPathContext context,
java.lang.String dateTime)
Return the day of the week given in a date as an English day abbreviation:
one of 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', or 'Sat'.
|
static double |
dayInMonth(XPathContext context)
Return the day number of the current date within the month
|
static double |
dayInMonth(XPathContext context,
java.lang.String dateTime)
Return the day number of a specified date within the month
|
static double |
dayInWeek(XPathContext context)
Return the day of the week in the current date as a number.
|
static double |
dayInWeek(XPathContext context,
java.lang.String dateTime)
Return the day of the week given in a date as a number.
|
static double |
dayInYear(XPathContext context)
Return the day number of the current date within the year
|
static double |
dayInYear(XPathContext context,
java.lang.String dateTime)
Return the day number of a specified date within the year
|
static java.lang.String |
dayName(XPathContext context)
Return the day of the week given in the current date as an English day name:
one of 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday' or 'Friday'.
|
static java.lang.String |
dayName(XPathContext context,
java.lang.String dateTime)
Return the day of the week given in a date as an English day name:
one of 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday' or 'Friday'.
|
static double |
dayOfWeekInMonth(XPathContext context)
Return the day-of-the-week in a month of the current date as a number
(for example 3 for the 3rd Tuesday in May).
|
static double |
dayOfWeekInMonth(XPathContext context,
java.lang.String dateTime)
Return the day-of-the-week in a month of a date as a number
(for example 3 for the 3rd Tuesday in May).
|
static java.lang.String |
difference(XPathContext context,
java.lang.String dateLeftIn,
java.lang.String dateRightIn)
The date:difference function returns the duration between the first date and the second date.
|
static java.lang.String |
duration(double seconds)
The date:duration function returns a duration string representing the number of seconds
specified by the argument string.
|
static double |
hourInDay(XPathContext context)
Return the current hour of the day
|
static double |
hourInDay(XPathContext context,
java.lang.String dateTime)
Return the hour of the day in the specified date or date/time
|
static boolean |
leapYear(XPathContext context)
Returns true if the current year is a leap year
|
static boolean |
leapYear(XPathContext context,
java.lang.String dateTime)
Return true if the year specified in the date/time string
given as the argument is a leap year.
|
static double |
minuteInHour(XPathContext context)
Return the current minute of the hour
|
static double |
minuteInHour(XPathContext context,
java.lang.String dateTime)
Return the minute of the hour in the specified date or date/time
|
static java.lang.String |
monthAbbreviation(XPathContext context)
Return the month abbreviation from the current date.
|
static java.lang.String |
monthAbbreviation(XPathContext context,
java.lang.String date)
Return the month abbreviation from a date.
|
static double |
monthInYear(XPathContext context)
Return the month number from the current date.
|
static double |
monthInYear(XPathContext context,
java.lang.String dateTime)
Return the month number from a date.
|
static java.lang.String |
monthName(XPathContext context)
Return the month name from the current date.
|
static java.lang.String |
monthName(XPathContext context,
java.lang.String date)
Return the month name from a date.
|
static double |
secondInMinute(XPathContext context)
Return the current second of the minute
|
static double |
secondInMinute(XPathContext context,
java.lang.String dateTime)
Return the second of the minute in the specified date or date/time
|
static double |
seconds(XPathContext context)
Return the number of seconds since 1 Jan 1970
|
static double |
seconds(XPathContext context,
java.lang.String datetimeIn)
The date:seconds function returns the number of seconds specified by the argument string.
|
static java.lang.String |
sum(SequenceIterator durations)
The date:sum function adds a set of durations together.
|
static java.lang.String |
time(XPathContext context)
The date:time function returns the current time.
|
static java.lang.String |
time(XPathContext context,
java.lang.String dateTime)
The date:time function returns the time specified in the date/time string given as the
argument.
|
static double |
weekInMonth(XPathContext context)
Return the ISO week number of the current date within the month
|
static double |
weekInMonth(XPathContext context,
java.lang.String dateTime)
Return the week number of a specified date within the month
(Note, this function is underspecified in EXSLT)
|
static double |
weekInYear(XPathContext context)
Return the ISO week number of the current date
(Note, this returns the ISO week number: the result in EXSLT is underspecified)
|
static double |
weekInYear(XPathContext context,
java.lang.String dateTime)
Return the ISO week number of a specified date within the year
(Note, this returns the ISO week number: the result in EXSLT is underspecified)
|
static double |
year(XPathContext context)
The date:year function returns the current year.
|
static double |
year(XPathContext context,
java.lang.String datetimeIn)
The date:year function returns the year of a date as a number.
|
public static java.lang.String dateTime(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date and time to be obtainedpublic static java.lang.String date(XPathContext context, java.lang.String datetimeIn)
context - the XPath dynamic contextdatetimeIn - the date and time as a date/time stringpublic static java.lang.String date(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow the date and time to be establishedpublic static java.lang.String time(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with [+|-]CCYY-MM-DDThh:mm:sspublic static java.lang.String time(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double year(XPathContext context, java.lang.String datetimeIn)
Note: although not specifically permitted in the EXSLT specification, the Saxon implementation also allows the input value to contain a timezone
context - the XPath dynamic contextdatetimeIn - the supplied date/time in ISO formatpublic static double year(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static boolean leapYear(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - a dateTime as a stringpublic static boolean leapYear(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double monthInYear(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - a dateTime as a stringpublic static double monthInYear(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static java.lang.String monthName(XPathContext context, java.lang.String date)
context - the XPath dynamic contextdate - the date/time as a stringpublic static java.lang.String monthName(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static java.lang.String monthAbbreviation(XPathContext context, java.lang.String date)
context - the XPath dynamic contextdate - The date must start with either "CCYY-MM" or "--MM"public static java.lang.String monthAbbreviation(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double weekInYear(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - the current date starting CCYY-MM-DDpublic static double weekInYear(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double weekInMonth(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - the date starting CCYY-MM-DDpublic static double weekInMonth(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double dayInYear(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - the date starting with CCYY-MM-DDpublic static double dayInYear(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double dayInMonth(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DD, or --MM-DD, or ---DDpublic static double dayInMonth(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double dayOfWeekInMonth(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDpublic static double dayOfWeekInMonth(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double dayInWeek(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDpublic static double dayInWeek(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static java.lang.String dayName(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDpublic static java.lang.String dayName(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static java.lang.String dayAbbreviation(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDpublic static java.lang.String dayAbbreviation(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double hourInDay(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDThh:mm:ss or hh:mm:sspublic static double hourInDay(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double minuteInHour(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDThh:mm:ss or hh:mm:sspublic static double minuteInHour(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double secondInMinute(XPathContext context, java.lang.String dateTime)
context - the XPath dynamic contextdateTime - must start with CCYY-MM-DDThh:mm:ss or hh:mm:sspublic static double secondInMinute(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static java.lang.String add(XPathContext context, java.lang.String datetimeIn, java.lang.String durationIn) throws XPathException
context - the XPath dynamic contextdatetimeIn - the supplied date/time in ISO date/time formatdurationIn - the supplied duration in ISO duration formatXPathException - if the supplied date or duration is invalidpublic static java.lang.String sum(SequenceIterator durations) throws XPathException
durations - a sequence which when atomized and converted to strings using the string()
function yields a sequence of strings representing the input durations in ISO formatXPathException - if the input sequence cannot be evaluatedpublic java.lang.String addDuration(java.lang.String duration0,
java.lang.String duration1)
duration0 - the first operand, a string in the format of an ISO durationduration1 - the second operand, a string in the format of an ISO durationpublic static java.lang.String difference(XPathContext context, java.lang.String dateLeftIn, java.lang.String dateRightIn)
context - the XPath dynamic contextdateLeftIn - the first operand, a string in the format of an ISO dateTime, date, yearMonth, or yeardateRightIn - the second operand, a string in the format of an ISO dateTime, date, yearMonth, or yearpublic static java.lang.String duration(double seconds)
seconds - the input number of secondspublic static double seconds(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if the context does not allow a date/time to be establishedpublic static double seconds(XPathContext context, java.lang.String datetimeIn)
context - the XPath dynamic contextdatetimeIn - the input dateTime, date, yearMonth, or year as an ISO stringCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.