|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Calendar java.util.GregorianCalendar org.apache.xmlbeans.XmlCalendar
public class XmlCalendar
An XML Schema compatible subclass of GregorianCalendar
.
XmlCalendar modifies several key details in the behavior of
GregorianCalendar to make it more useful when dealing with XML dates.
It is easy to convert between XmlCalendar and GDate
, or to
parse or emit an XmlCalendar using a standard XML Schema
lexical representation.
GregorianCalendar
, which chooses 1970. The reason 0 is preferable
is that it is a leap year and so it permits the date --2-29 to be specified
stably. A different default year can be chosen via the static method
XmlCalendar.setDefaultYear()
, or by setting the
system property "user.defaultyear". If you do change this value, you should
pick another leap year such as 2000 and avoid non-leap years such as 1900.
TimeZone.getDefault()
if not.
For example, the XML timezone "Z" is translated to "GMT"; the XML timezone "+05:00" is translated to "GMT+05:00".
Field Summary |
---|
Fields inherited from class java.util.GregorianCalendar |
---|
AD, BC |
Fields inherited from class java.util.Calendar |
---|
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET |
Constructor Summary | |
---|---|
XmlCalendar()
Constructs an empty instance with no fields set. |
|
XmlCalendar(java.util.Date date)
Constructs an XmlCalendar from a Date. |
|
XmlCalendar(GDateSpecification date)
Constructs an XmlCalendar from a GDate. |
|
XmlCalendar(int year,
int month,
int day,
int hour,
int minute,
int second,
java.math.BigDecimal fraction)
Constructs an XmlCalendar with the specified year, month, day, hours, minutes, seconds, and optional fractional seconds, in the default timezone. |
|
XmlCalendar(int year,
int month,
int day,
int hour,
int minute,
int second,
java.math.BigDecimal fraction,
int tzSign,
int tzHour,
int tzMinute)
Constructs an XmlCalendar with the specified year, month, day, hours, minutes, seconds, and optional fractional seconds, in the specified timezone. |
|
XmlCalendar(java.lang.String xmlSchemaDateString)
Constructs an XmlCalendar for a standard XML schema formatted date string. |
Method Summary | |
---|---|
protected void |
computeTime()
Overrides GregorianCalendar.computeTime to apply a different default year. |
int |
get(int field)
Gets the value for a given time field. |
static int |
getDefaultYear()
Returns the default year that is used when no year is specified. |
static void |
setDefaultYear(int year)
Sets the default year to be used when no year is specified. |
java.lang.String |
toString()
Prints the XmlCalendar using a standard XML Schema format, as described in XmlCalendar(String s). |
Methods inherited from class java.util.GregorianCalendar |
---|
add, clone, computeFields, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, hashCode, isLeapYear, roll, roll, setGregorianChange, setTimeZone |
Methods inherited from class java.util.Calendar |
---|
after, before, clear, clear, compareTo, complete, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XmlCalendar(java.lang.String xmlSchemaDateString)
public XmlCalendar(GDateSpecification date)
public XmlCalendar(java.util.Date date)
public XmlCalendar(int year, int month, int day, int hour, int minute, int second, java.math.BigDecimal fraction)
public XmlCalendar(int year, int month, int day, int hour, int minute, int second, java.math.BigDecimal fraction, int tzSign, int tzHour, int tzMinute)
public XmlCalendar()
Method Detail |
---|
public int get(int field)
get
in class java.util.Calendar
public static int getDefaultYear()
public static void setDefaultYear(int year)
protected void computeTime()
computeTime
in class java.util.GregorianCalendar
public java.lang.String toString()
toString
in class java.util.Calendar
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |