public class XSDDateTime extends AbstractDateTime
Modifier and Type | Field and Description |
---|---|
static short |
DAY_MASK
Mask to indicate whether day is present
|
static short |
FULL_MASK
Mask to indicate all date/time are present
|
static short |
MONTH_MASK
Mask to indicate whether month is present
|
static short |
TIME_MASK
Mask to indicate whether time is present
|
static short |
YEAR_MASK
Mask to indicate whether year is present
|
EQUAL, GREATER_THAN, INDETERMINATE, LESS_THAN
Constructor and Description |
---|
XSDDateTime(Calendar date)
Constructor - create a full DateTime object from a java calendar instance.
|
XSDDateTime(Object value,
int mask)
Constructor - should only be used by the internals but public scope because
the internals spread across multiple packages.
|
Modifier and Type | Method and Description |
---|---|
Calendar |
asCalendar()
Return the date time as a java Calendar object.
|
int |
getDays()
Return the number of years in the dateTime
|
int |
getFullSeconds()
Return the number of full seconds in the dateTime
|
int |
getHours()
Return the number of hours in the dateTime
|
int |
getMinutes()
Return the number of minutes in the dateTime
|
int |
getMonths()
Return the month in the dateTime, this is in ISO8601 format so january = 1
|
XSDDatatype |
getNarrowedDatatype()
Return the most specific xsd type which can represent
this date/time
|
double |
getSeconds()
Return the number of seconds in the dateTime, including fractional part
|
double |
getTimePart()
Return the time component of the dateTime - i.e.
|
int |
getYears()
Return the number of years in the dateTime.
|
void |
narrowType(XSDDatatype dt)
Set the mask for this date/time to be that appropriate
for the given XSD subtype.
|
String |
timeLexicalForm()
Return the lexical form of the time component.
|
String |
toString()
Return legal serialized form.
|
public static final short YEAR_MASK
public static final short MONTH_MASK
public static final short DAY_MASK
public static final short TIME_MASK
public static final short FULL_MASK
public XSDDateTime(Object value, int mask)
value
- the date/time value returned by the parsingmask
- bitmask defining which components are valid in this instance
(e.g. dates don't have valid time fields).public XSDDateTime(Calendar date)
date
- java calendar instancepublic XSDDatatype getNarrowedDatatype()
public void narrowType(XSDDatatype dt)
public Calendar asCalendar() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if this is not a full date + timepublic int getYears() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal year componentpublic int getMonths() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal month componentpublic int getDays() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal day componentpublic int getHours() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal time componentpublic int getMinutes() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal time componentpublic int getFullSeconds() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal time componentpublic double getSeconds() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal time componentpublic double getTimePart() throws IllegalDateTimeFieldException
IllegalDateTimeFieldException
- if there is no legal time componentpublic String timeLexicalForm()
Licenced under the Apache License, Version 2.0