net.sf.saxon.value
public class DateValue extends CalendarValue
Field Summary | |
---|---|
protected byte | day |
protected byte | month |
protected int | year |
Constructor Summary | |
---|---|
protected | DateValue()
Default constructor needed for subtyping |
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(CharSequence s)
Constructor: create a dateTime 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 other)
Compare the value to another date value. |
int | compareTo(CalendarValue other, XPathContext context)
Compare this value to another value of the same type, using the supplied context object
to get the implicit timezone if required. |
AtomicValue | convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type |
Object | convertToJava(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 |
static DateValue | dateFromJulianDayNumber(int julianDayNumber)
Get the Gregorian date corresponding to a particular Julian day number. |
boolean | equals(Object other) |
GregorianCalendar | getCalendar() |
AtomicValue | getComponent(int component)
Get a component of the value. |
byte | getDay()
Get the day component of the date (in local form) |
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) |
ItemType | getItemType(TypeHierarchy th)
Determine the data type of the expression |
static int | getJulianDayNumber(int year, int month, int day)
Calculate the Julian day number at 00:00 on a given date. |
byte | getMonth()
Get the month component of the date (in local form) |
CharSequence | getStringValueCS()
Convert to string |
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. |
int | getYear()
Get the year component of the date (in local form) |
int | hashCode() |
static boolean | isLeapYear(int year)
Test whether a year is a leap year |
static boolean | isValidDate(int year, int month, int day) |
static void | main(String[] args)
Temporary test rig |
void | setLexicalValue(CharSequence s)
Initialize the DateValue using a character string in the format yyyy-mm-dd and an optional time zone.
|
SecondsDurationValue | subtract(CalendarValue other, XPathContext context)
Determine the difference between two points in time, as a duration |
DateTimeValue | toDateTime()
Convert to DateTime |
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 CalendarValue.NO_TIMEZONE if there is no timezone component.
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: other The other date value. Must be an object of class DateValue.
Returns: negative value if this one is the earlier, 0 if they are chronologically equal, positive value if this one is the later. For this purpose, dateTime values with an unknown timezone are considered to be UTC values (the Comparable interface requires a total ordering).
Throws: ClassCastException if the other value is not a DateValue (the parameter is declared as Object to satisfy the Comparable interface)
Parameters: requiredType an integer identifying the required atomic type context
Returns: an AtomicValue, a value of the required type; or an ErrorValue
Returns: a DateValue with no timezone information set
Parameters: th
Returns: Type.DATE_TYPE,
Returns: ISO 8601 representation.
Parameters: s the supplied string value
Throws: net.sf.saxon.trans.XPathException
Parameters: other the other point in time context
Returns: the duration as an xdt:dayTimeDuration
Throws: net.sf.saxon.trans.XPathException for example if one value is a date and the other is a time
Returns: a new DateValue with no timezone information
Returns: a new DateValue with no timezone information