public final class DateTimeValue extends CalendarValue
NO_TIMEZONEEMPTY_CLASS_ARRAYEMPTY_VALUE_ARRAYEVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD| Constructor and Description |
|---|
DateTimeValue(java.util.Calendar calendar,
boolean tzSpecified)
Constructor: create a dateTime value given a Java calendar object
|
DateTimeValue(java.lang.CharSequence s)
Constructor: create a dateTime value from a supplied string, in
ISO 8601 format
|
DateTimeValue(DateValue date,
TimeValue time)
Constructor: create a dateTime value given a date and a time.
|
DateTimeValue(int year,
byte month,
byte day,
byte hour,
byte minute,
byte second,
int microsecond,
int tz)
Constructor: construct a DateTimeValue from its components.
|
| Modifier and Type | Method and Description |
|---|---|
CalendarValue |
add(DurationValue duration)
Add a duration to a dateTime
|
CalendarValue |
adjustTimezone(int timezone)
Return a new dateTime with the same normalized value, but
in a different timezone.
|
int |
compareTo(CalendarValue other,
Configuration config)
Compare the value to another dateTime value, following the XPath comparison semantics
|
int |
compareTo(java.lang.Object other)
Compare the value to another dateTime value.
|
AtomicValue |
convertPrimitive(BuiltInAtomicType requiredType,
boolean validate,
XPathContext context)
Convert to target data type
|
java.lang.Object |
convertToJava(java.lang.Class target,
XPathContext context)
Convert to Java object (for passing to external functions)
|
CalendarValue |
copy()
Make a copy of this date, time, or dateTime value
|
boolean |
equals(java.lang.Object other)
Compare two (sequence) values for equality.
|
static DateTimeValue |
fromJulianInstant(java.math.BigDecimal instant)
Get the DateTimeValue corresponding to a given Julian instant
|
java.util.GregorianCalendar |
getCalendar()
Get a Calendar object representing the value of this DateTime.
|
ComparisonKey |
getComparisonKey(Configuration config)
Get a comparison key for this value.
|
AtomicValue |
getComponent(int component)
Get a component of the value.
|
static DateTimeValue |
getCurrentDateTime(XPathContext context)
Get the dateTime value representing the nominal
date/time of this transformation run.
|
byte |
getDay()
Get the day component, 1-31
|
byte |
getHour()
Get the hour component, 0-23
|
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the exprssion
|
int |
getMicrosecond()
Get the microsecond component, 0-999999
|
byte |
getMinute()
Get the minute component, 0-59
|
byte |
getMonth()
Get the month component, 1-12
|
byte |
getSecond()
Get the second component, 0-59
|
java.lang.CharSequence |
getStringValueCS()
Convert to string
|
int |
getYear()
Get the year component, in its internal form (which allows a year zero)
|
int |
hashCode()
Return a hash code to support the equals() function
|
DateTimeValue |
normalize(Configuration cc)
Normalize the date and time to be in timezone Z.
|
SecondsDurationValue |
subtract(CalendarValue other,
XPathContext context)
Determine the difference between two points in time, as a duration
|
DateTimeValue |
toDateTime()
Convert the value to a DateTime, retaining all the components that are actually present, and
substituting conventional values for components that are missing
|
java.math.BigDecimal |
toJulianInstant()
Get the Julian instant: a decimal value whose integer part is the Julian day number
multiplied by the number of seconds per day,
and whose fractional part is the fraction of the second.
|
appendString, appendTimezone, appendTimezone, appendTwoDigits, getStringValue, getTimezoneInMinutes, hasTimezone, removeTimezone, setTimezoneInMinutescheckPermittedContents, convert, convert, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getImplementationMethod, getLength, getPrimitiveValue, getTypedValue, hasBuiltInType, iterate, process, toStringasItem, asIterator, asValue, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, optimize, promote, reduce, simplify, stringToNumber, typeCheckpublic DateTimeValue(java.util.Calendar calendar,
boolean tzSpecified)
calendar - holds the date and timetzSpecified - indicates whether the timezone is specifiedpublic DateTimeValue(DateValue date, TimeValue time) throws XPathException
date - the datetime - the timeXPathException - if the timezones are both present and inconsistentpublic DateTimeValue(java.lang.CharSequence s)
throws XPathException
XPathExceptionpublic DateTimeValue(int year,
byte month,
byte day,
byte hour,
byte minute,
byte second,
int microsecond,
int tz)
year - The year as held internally (note that the year before 1AD is 0)month - The month, 1-12day - The day 1-31hour - the hour value, 0-23minute - the minutes value, 0-59second - the seconds value, 0-59microsecond - the number of microseconds, 0-999999tz - the timezone displacement in minutes from UTC. Supply the value
CalendarValue.NO_TIMEZONE if there is no timezone component.public static DateTimeValue getCurrentDateTime(XPathContext context)
public int getYear()
public byte getMonth()
public byte getDay()
public byte getHour()
public byte getMinute()
public byte getSecond()
public int getMicrosecond()
public DateTimeValue toDateTime()
toDateTime in class CalendarValuepublic DateTimeValue normalize(Configuration cc)
cc - used to supply the implicit timezone, used when the value has
no explicit timezonepublic ComparisonKey getComparisonKey(Configuration config)
getComparisonKey in class CalendarValuepublic java.math.BigDecimal toJulianInstant()
public static DateTimeValue fromJulianInstant(java.math.BigDecimal instant)
public java.util.GregorianCalendar getCalendar()
getCalendar in class CalendarValuepublic AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
convertPrimitive in class AtomicValuerequiredType - an integer identifying the required atomic typecontext - validate - true if validation is required. If set to false, the caller guarantees that
the value is valid for the target data type, and that further validation is therefore not required.
Note that a validation failure may be reported even if validation was not requested.public java.lang.CharSequence getStringValueCS()
getStringValueCS in interface ItemgetStringValueCS in interface ValueRepresentationgetStringValueCS in class AtomicValueItem.getStringValue()public ItemType getItemType(TypeHierarchy th)
getItemType in interface ExpressiongetItemType in class Valueth - public CalendarValue copy()
copy in class CalendarValuepublic CalendarValue adjustTimezone(int timezone)
adjustTimezone in class CalendarValuetimezone - the new timezone offset, in minutespublic CalendarValue add(DurationValue duration) throws XPathException
add in class CalendarValueduration - the duration to be added (may be negative)XPathException - if the duration is an xs:duration, as distinct from
a subclass thereofpublic SecondsDurationValue subtract(CalendarValue other, XPathContext context) throws XPathException
subtract in class CalendarValueother - the other point in timecontext - XPathException - for example if one value is a date and the other is a timepublic java.lang.Object convertToJava(java.lang.Class target,
XPathContext context)
throws XPathException
convertToJava in class ValueXPathExceptionpublic AtomicValue getComponent(int component) throws XPathException
getComponent in class AtomicValueXPathExceptionpublic int compareTo(java.lang.Object other)
This method is not used for XPath comparisons because it does not have access to the implicitTimezone from the dynamic context. It is available for schema comparisons, although it does not currently implement the XML Schema semantics for timezone comparison (which involve partial ordering)
other - The other dateTime valuejava.lang.ClassCastException - if the other value is not a DateTimeValue (the parameter
is declared as Object to satisfy the Comparable interface)public int compareTo(CalendarValue other, Configuration config)
compareTo in class CalendarValueother - The other dateTime valueconfig - A Configuration used to supply the implicit timezonejava.lang.ClassCastException - if the other value is not a DateTimeValue (the parameter
is declared as Object to satisfy the Comparable interface)public boolean equals(java.lang.Object other)
Value