net.sf.saxon.value
public class DateValue extends GDateValue implements Comparable
Constructor Summary | |
---|---|
DateValue(int year, byte month, byte day)
Constructor given a year, month, and day. | |
DateValue(int year, byte month, byte day, int tz)
Constructor given a year, month, and day, and timezone. | |
DateValue(int year, byte month, byte day, int tz, AtomicType type)
Constructor given a year, month, and day, and timezone, and an AtomicType representing
a subtype of xs:date. | |
DateValue(CharSequence s)
Constructor: create a date value from a supplied string, in
ISO 8601 format | |
DateValue(GregorianCalendar calendar, int tz)
Create a DateValue |
Method Summary | |
---|---|
CalendarValue | add(DurationValue duration)
Add a duration to a date |
CalendarValue | adjustTimezone(int timezone)
Return a new date with the same normalized value, but
in a different timezone. |
int | compareTo(Object v2)
Context-free comparison of two DateValue values. |
ConversionResult | convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type |
AtomicValue | copyAsSubType(AtomicType typeLabel)
Make a copy of this date value, but with a new type label |
static DateValue | dateFromJulianDayNumber(int julianDayNumber)
Get the Gregorian date corresponding to a particular Julian day number. |
CharSequence | getCanonicalLexicalRepresentation()
Get the canonical lexical representation as defined in XML Schema. |
static int | getDayOfWeek(int year, int month, int day)
Get the day of the week. |
static int | getDayWithinYear(int year, int month, int day)
Get the ordinal day number within the year (1 Jan = 1, 1 Feb = 32, etc) |
static int | getJulianDayNumber(int year, int month, int day)
Calculate the Julian day number at 00:00 on a given date. |
CharSequence | getPrimitiveStringValue()
Convert to string |
BuiltInAtomicType | getPrimitiveType()
Determine the primitive type of the value. |
static int | getWeekNumber(int year, int month, int day)
Get the ISO week number for a given date. |
static int | getWeekNumberWithinMonth(int year, int month, int day)
Get the week number within a month. |
static ConversionResult | makeDateValue(CharSequence in)
Static factory method: construct a DateValue from a string in the lexical form
of a date, returning a ValidationFailure if the supplied string is invalid |
DayTimeDurationValue | subtract(CalendarValue other, XPathContext context)
Determine the difference between two points in time, as a duration |
static DateValue | tomorrow(int year, byte month, byte day)
Get the date that immediately follows a given date |
static DateValue | yesterday(int year, byte month, byte day)
Get the date that immediately precedes a given date |
Parameters: year The year as held internally (note that the year before 1AD is 0) month The month, 1-12 day The day 1-31
Parameters: year The year as held internally (note that the year before 1AD is 0) month The month, 1-12 day The day 1-31 tz the timezone displacement in minutes from UTC. Supply the value NO_TIMEZONE if there is no timezone component.
Parameters: year The year as held internally (note that the year before 1AD is 0) month The month, 1-12 day The day 1-31 tz the timezone displacement in minutes from UTC. Supply the value NO_TIMEZONE if there is no timezone component. type the type. This must be a type derived from xs:date, and the value must conform to this type. The method does not check these conditions.
Parameters: s the lexical form of the date value
Throws: ValidationException if the supplied string is not a valid date
Parameters: calendar the absolute date/time value tz The timezone offset from GMT in minutes, positive or negative; or the special value NO_TIMEZONE indicating that the value is not in a timezone
Parameters: duration the duration to be added (may be negative)
Returns: the new date
Throws: net.sf.saxon.trans.XPathException if the duration is an xs:duration, as distinct from a subclass thereof
Parameters: timezone the new timezone offset, in minutes
Returns: the time in the new timezone. This will be a new TimeValue unless no change was required to the original value
Parameters: v2 the other value
Returns: the result of the comparison: -1 if the first is earlier, 0 if they are equal, +1 if the first is later
Throws: ClassCastException if the values are not comparable (which might be because no timezone is available)
Parameters: requiredType an integer identifying the required atomic type context the XPath dynamic context
Returns: an AtomicValue, a value of the required type; or an ErrorValue
Parameters: typeLabel the new type label: must be a subtype of xs:date
Returns: the new xs:date value
Parameters: julianDayNumber the Julian day number
Returns: a DateValue with no timezone information set
Returns: the canonical lexical representation if defined in XML Schema; otherwise, the result of casting to string according to the XPath 2.0 rules
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: the day of the week, 1=Monday .... 7=Sunday
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: the ordinal day number within the year
Note that this assumes dates in the proleptic Gregorian calendar
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: the Julian day number
Returns: ISO 8601 representation.
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: the ISO week number
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: the week number within a month
Parameters: in the lexical form of the date
Returns: either a DateValue or a ValidationFailure
Parameters: other the other point in time context the XPath dynamic context
Returns: the duration as an xs:dayTimeDuration
Throws: XPathException for example if one value is a date and the other is a time
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: a new DateValue with no timezone information
Parameters: year the year month the month (1-12) day the day (1-31)
Returns: a new DateValue with no timezone information