- java.lang.Object
- 
- javax.xml.datatype.XMLGregorianCalendar
 
- 
- All Implemented Interfaces:
- Cloneable
 
 public abstract class XMLGregorianCalendar extends Object implements Cloneable Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are DatatypeConstants.DATETIME,DatatypeConstants.TIME,DatatypeConstants.DATE,DatatypeConstants.GYEARMONTH,DatatypeConstants.GMONTHDAY,DatatypeConstants.GYEAR,DatatypeConstants.GMONTH, andDatatypeConstants.GDAYdefined in the XML Namespace"http://www.w3.org/2001/XMLSchema". These datatypes are normatively defined in W3C XML Schema 1.0 Part 2, Section 3.2.7-14.The table below defines the mapping between XML Schema 1.0 date/time datatype fields and this class' fields. It also summarizes the value constraints for the date and time fields defined in W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats. Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation XML Schema 1.0 
 datatype
 fieldRelated 
 XMLGregorianCalendar
 Accessor(s)Value Range year getYear()+getEon()or
 getEonAndYear()getYear()is a value between -(10^9-1) to (10^9)-1 orDatatypeConstants.FIELD_UNDEFINED.
 getEon()is high order year value in billion of years.
 getEon()has values greater than or equal to (10^9) or less than or equal to -(10^9). A value of null indicates field is undefined.
 Given that XML Schema 1.0 errata states that the year zero will be a valid lexical value in a future version of XML Schema, this class allows the year field to be set to zero. Otherwise, the year field value is handled exactly as described in the errata and [ISO-8601-1988]. Note that W3C XML Schema 1.0 validation does not allow for the year field to have a value of zero.month getMonth()1 to 12 or DatatypeConstants.FIELD_UNDEFINEDday getDay()Independent of month, max range is 1 to 31 or DatatypeConstants.FIELD_UNDEFINED.
 The normative value constraint stated relative to month field's value is in W3C XML Schema 1.0 Part 2, Appendix D.hour getHour()0 to 23 or DatatypeConstants.FIELD_UNDEFINED. An hour value of 24 is allowed to be set in the lexical space provided the minute and second field values are zero. However, an hour value of 24 is not allowed in value space and will be transformed to represent the value of the first instance of the following day as per XML Schema Part 2: Datatypes Second Edition, 3.2 Primitive datatypes.minute getMinute()0 to 59 or DatatypeConstants.FIELD_UNDEFINEDsecond getSecond()+getMillisecond()/1000 or
 getSecond()+getFractionalSecond()getSecond()from 0 to 60 orDatatypeConstants.FIELD_UNDEFINED.
 (Note: 60 only allowable for leap second.)
 getFractionalSecond()allows for infinite precision over the range from 0.0 to 1.0 when thegetSecond()is defined.
 FractionalSecondis optional and has a value ofnullwhen it is undefined.
 getMillisecond()is the convenience millisecond precision of value ofgetFractionalSecond().timezone getTimezone()Number of minutes or DatatypeConstants.FIELD_UNDEFINED. Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).All maximum value space constraints listed for the fields in the table above are checked by factory methods, DatatypeFactory, setter methods and parse methods of this class.IllegalArgumentExceptionis thrown when a parameter's value is outside the value constraint for the field or if the composite values constitute an invalid XMLGregorianCalendar instance (for example, if the 31st of June is specified).The following operations are defined for this class: - accessors/mutators for independent date/time fields
- conversion between this class and W3C XML Schema 1.0 lexical representation,
     toString(),DatatypeFactory.newXMLGregorianCalendar(String lexicalRepresentation)
- conversion between this class and GregorianCalendar,toGregorianCalendar(java.util.TimeZone timezone, java.util.Locale aLocale, XMLGregorianCalendar defaults),DatatypeFactory
- partial order relation comparator method, compare(XMLGregorianCalendar xmlGregorianCalendar)
- equals(Object)defined relative to- compare(XMLGregorianCalendar xmlGregorianCalendar).
- addition operation with Durationinstance as defined in W3C XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes.
 - Since:
- 1.5
- See Also:
- Duration,- DatatypeFactory
 
- 
- 
Constructor SummaryConstructors Constructor Description XMLGregorianCalendar()Default no-arg constructor.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidadd(Duration duration)Adddurationto this instance.abstract voidclear()Unset all fields to undefined.abstract Objectclone()Creates and returns a copy of this object.abstract intcompare(XMLGregorianCalendar xmlGregorianCalendar)Compare two instances of W3C XML Schema 1.0 date/time datatypes according to partial order relation defined in W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime.booleanequals(Object obj)Compares this calendar to the specified object.abstract intgetDay()Returns the day of month orDatatypeConstants.FIELD_UNDEFINED.abstract BigIntegergetEon()Returns the high order component for XML Schema 1.0 dateTime datatype field foryear.abstract BigIntegergetEonAndYear()Returns the XML Schema 1.0 dateTime datatype field foryear.abstract BigDecimalgetFractionalSecond()Returns fractional seconds.abstract intgetHour()Returns the hour of day orDatatypeConstants.FIELD_UNDEFINEDif this field is not defined.intgetMillisecond()Returns the millisecond precision ofgetFractionalSecond().abstract intgetMinute()Returns the minute of hour orDatatypeConstants.FIELD_UNDEFINEDif this field is not defined.abstract intgetMonth()Returns the month of this calendar orDatatypeConstants.FIELD_UNDEFINED.abstract intgetSecond()Returns the second of minute orDatatypeConstants.FIELD_UNDEFINEDif this field is not defined.abstract intgetTimezone()Returns the Timezone offset in minutes orDatatypeConstants.FIELD_UNDEFINEDif this optional field is not defined.abstract TimeZonegetTimeZone(int defaultZoneoffset)Returns ajava.util.TimeZonefor this class.abstract QNamegetXMLSchemaType()Return the name of the XML Schema date/time type that this instance maps to.abstract intgetYear()Returns the low order component for XML Schema 1.0 dateTime datatype field foryearorDatatypeConstants.FIELD_UNDEFINED.inthashCode()Returns a hash code consistent with the definition of the equals method.abstract booleanisValid()Validate instance bygetXMLSchemaType()constraints.abstract XMLGregorianCalendarnormalize()Normalize this instance to UTC.abstract voidreset()Reset thisXMLGregorianCalendarto its original values.abstract voidsetDay(int day)Set days in month.abstract voidsetFractionalSecond(BigDecimal fractional)Set fractional seconds.abstract voidsetHour(int hour)Set hours.abstract voidsetMillisecond(int millisecond)Set milliseconds.abstract voidsetMinute(int minute)Set minutes.abstract voidsetMonth(int month)Set month.abstract voidsetSecond(int second)Set seconds.voidsetTime(int hour, int minute, int second)Set time as one unit.voidsetTime(int hour, int minute, int second, int millisecond)Set time as one unit, including optional milliseconds.voidsetTime(int hour, int minute, int second, BigDecimal fractional)Set time as one unit, including the optional infinite precision fractional seconds.abstract voidsetTimezone(int offset)Set the number of minutes in the timezone offset.abstract voidsetYear(int year)Set year of XSDdateTimeyear field.abstract voidsetYear(BigInteger year)Set low and high order component of XSDdateTimeyear field.abstract GregorianCalendartoGregorianCalendar()Convert thisXMLGregorianCalendarto aGregorianCalendar.abstract GregorianCalendartoGregorianCalendar(TimeZone timezone, Locale aLocale, XMLGregorianCalendar defaults)Convert thisXMLGregorianCalendaralong with provided parameters to aGregorianCalendarinstance.StringtoString()Returns aStringrepresentation of thisXMLGregorianCalendarObject.abstract StringtoXMLFormat()Return the lexical representation ofthisinstance.
 
- 
- 
- 
Constructor Detail- 
XMLGregorianCalendarpublic XMLGregorianCalendar() Default no-arg constructor.Note: Always use the DatatypeFactoryto construct an instance ofXMLGregorianCalendar. The constructor on this class cannot be guaranteed to produce an object with a consistent state and may be removed in the future.
 
- 
 - 
Method Detail- 
clearpublic abstract void clear() Unset all fields to undefined.Set all int fields to DatatypeConstants.FIELD_UNDEFINEDand reference fields to null.
 - 
resetpublic abstract void reset() Reset thisXMLGregorianCalendarto its original values.XMLGregorianCalendaris reset to the same values as when it was created withDatatypeFactory.newXMLGregorianCalendar(),DatatypeFactory.newXMLGregorianCalendar(String lexicalRepresentation),DatatypeFactory.newXMLGregorianCalendar( BigInteger year, int month, int day, int hour, int minute, int second, BigDecimal fractionalSecond, int timezone),DatatypeFactory.newXMLGregorianCalendar( int year, int month, int day, int hour, int minute, int second, int millisecond, int timezone),DatatypeFactory.newXMLGregorianCalendar(GregorianCalendar cal),DatatypeFactory.newXMLGregorianCalendarDate( int year, int month, int day, int timezone),DatatypeFactory.newXMLGregorianCalendarTime( int hours, int minutes, int seconds, int timezone),DatatypeFactory.newXMLGregorianCalendarTime( int hours, int minutes, int seconds, BigDecimal fractionalSecond, int timezone)orDatatypeFactory.newXMLGregorianCalendarTime( int hours, int minutes, int seconds, int milliseconds, int timezone).reset()is designed to allow the reuse of existingXMLGregorianCalendars thus saving resources associated with the creation of newXMLGregorianCalendars.
 - 
setYearpublic abstract void setYear(BigInteger year) Set low and high order component of XSDdateTimeyear field.Unset this field by invoking the setter with a parameter value of null.- Parameters:
- year- value constraints summarized in year field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- yearparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setYearpublic abstract void setYear(int year) Set year of XSDdateTimeyear field.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.Note: if the absolute value of the yearparameter is less than 10^9, the eon component of the XSD year field is set tonullby this method.- Parameters:
- year- value constraints are summarized in year field of date/time field mapping table. If year is- DatatypeConstants.FIELD_UNDEFINED, then eon is set to- null.
 
 - 
setMonthpublic abstract void setMonth(int month) Set month.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- month- value constraints summarized in month field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- monthparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setDaypublic abstract void setDay(int day) Set days in month.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- day- value constraints summarized in day field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- dayparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setTimezonepublic abstract void setTimezone(int offset) Set the number of minutes in the timezone offset.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- offset- value constraints summarized in timezone field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- offsetparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setTimepublic void setTime(int hour, int minute, int second)Set time as one unit.- Parameters:
- hour- value constraints are summarized in hour field of date/time field mapping table.
- minute- value constraints are summarized in minute field of date/time field mapping table.
- second- value constraints are summarized in second field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if any parameter is outside value constraints for the field as specified in date/time field mapping table.
- See Also:
- setTime(int, int, int, BigDecimal)
 
 - 
setHourpublic abstract void setHour(int hour) Set hours.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- hour- value constraints summarized in hour field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- hourparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setMinutepublic abstract void setMinute(int minute) Set minutes.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- minute- value constraints summarized in minute field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- minuteparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setSecondpublic abstract void setSecond(int second) Set seconds.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- second- value constraints summarized in second field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- secondparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setMillisecondpublic abstract void setMillisecond(int millisecond) Set milliseconds.Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.- Parameters:
- millisecond- value constraints summarized in second field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- millisecondparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setFractionalSecondpublic abstract void setFractionalSecond(BigDecimal fractional) Set fractional seconds.Unset this field by invoking the setter with a parameter value of null.- Parameters:
- fractional- value constraints summarized in second field of date/time field mapping table.
- Throws:
- IllegalArgumentException- if- fractionalparameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setTimepublic void setTime(int hour, int minute, int second, BigDecimal fractional)Set time as one unit, including the optional infinite precision fractional seconds.- Parameters:
- hour- value constraints are summarized in hour field of date/time field mapping table.
- minute- value constraints are summarized in minute field of date/time field mapping table.
- second- value constraints are summarized in second field of date/time field mapping table.
- fractional- value of- nullindicates this optional field is not set.
- Throws:
- IllegalArgumentException- if any parameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
setTimepublic void setTime(int hour, int minute, int second, int millisecond)Set time as one unit, including optional milliseconds.- Parameters:
- hour- value constraints are summarized in hour field of date/time field mapping table.
- minute- value constraints are summarized in minute field of date/time field mapping table.
- second- value constraints are summarized in second field of date/time field mapping table.
- millisecond- value of- DatatypeConstants.FIELD_UNDEFINEDindicates this optional field is not set.
- Throws:
- IllegalArgumentException- if any parameter is outside value constraints for the field as specified in date/time field mapping table.
 
 - 
getEonpublic abstract BigInteger getEon() Returns the high order component for XML Schema 1.0 dateTime datatype field foryear.nullif this optional part of the year field is not defined.Value constraints for this value are summarized in year field of date/time field mapping table. - Returns:
- The eon of this XMLGregorianCalendar. The value returned is an integer multiple of 10^9.
- See Also:
- getYear(),- getEonAndYear()
 
 - 
getYearpublic abstract int getYear() Returns the low order component for XML Schema 1.0 dateTime datatype field foryearorDatatypeConstants.FIELD_UNDEFINED.Value constraints for this value are summarized in year field of date/time field mapping table. - Returns:
- The year of this XMLGregorianCalendar.
- See Also:
- getEon(),- getEonAndYear()
 
 - 
getEonAndYearpublic abstract BigInteger getEonAndYear() Returns the XML Schema 1.0 dateTime datatype field foryear.Value constraints for this value are summarized in year field of date/time field mapping table. 
 - 
getMonthpublic abstract int getMonth() Returns the month of this calendar orDatatypeConstants.FIELD_UNDEFINED.Value constraints for this value are summarized in month field of date/time field mapping table. - Returns:
- The month of this XMLGregorianCalendar, from 1 to 12.
 
 - 
getDaypublic abstract int getDay() Returns the day of month orDatatypeConstants.FIELD_UNDEFINED.Value constraints for this value are summarized in day field of date/time field mapping table. - Returns:
- The day of month of this XMLGregorianCalendar, from 1 to 31.
- See Also:
- setDay(int)
 
 - 
getTimezonepublic abstract int getTimezone() Returns the Timezone offset in minutes orDatatypeConstants.FIELD_UNDEFINEDif this optional field is not defined.Value constraints for this value are summarized in timezone field of date/time field mapping table. - Returns:
- The Timezone offset in minutes of this XMLGregorianCalendar.
- See Also:
- setTimezone(int)
 
 - 
getHourpublic abstract int getHour() Returns the hour of day orDatatypeConstants.FIELD_UNDEFINEDif this field is not defined.Value constraints for this value are summarized in hour field of date/time field mapping table. - Returns:
- The hour of day of this XMLGregorianCalendar, from 0 to 23.
- See Also:
- setTime(int, int, int)
 
 - 
getMinutepublic abstract int getMinute() Returns the minute of hour orDatatypeConstants.FIELD_UNDEFINEDif this field is not defined.Value constraints for this value are summarized in minute field of date/time field mapping table. - Returns:
- The minute of hour of this XMLGregorianCalendar, from 0 to 59.
- See Also:
- setTime(int, int, int)
 
 - 
getSecondpublic abstract int getSecond() Returns the second of minute orDatatypeConstants.FIELD_UNDEFINEDif this field is not defined. When this field is not defined, the optional xs:dateTime fractional seconds field, represented bygetFractionalSecond()andgetMillisecond(), must not be defined.Value constraints for this value are summarized in second field of date/time field mapping table. - Returns:
- The second of minute of this XMLGregorianCalendar, from 0 to 59.
- See Also:
- getFractionalSecond(),- getMillisecond(),- setTime(int, int, int)
 
 - 
getMillisecondpublic int getMillisecond() Returns the millisecond precision ofgetFractionalSecond().This method represents a convenience accessor to infinite precision fractional second value returned by getFractionalSecond(). The returned value is the rounded down to milliseconds value ofgetFractionalSecond(). WhengetFractionalSecond()returnsnull, this method must returnDatatypeConstants.FIELD_UNDEFINED.Value constraints for this value are summarized in second field of date/time field mapping table. - Returns:
- The millisecond precision of this XMLGregorianCalendar.
- See Also:
- getFractionalSecond(),- setTime(int, int, int)
 
 - 
getFractionalSecondpublic abstract BigDecimal getFractionalSecond() Returns fractional seconds.nullis returned when this optional field is not defined.Value constraints are detailed in second field of date/time field mapping table. This optional field can only have a defined value when the xs:dateTime second field, represented by getSecond(), does not returnDatatypeConstants.FIELD_UNDEFINED.- Returns:
- Fractional seconds of this XMLGregorianCalendar.
- See Also:
- getSecond(),- setTime(int, int, int, BigDecimal)
 
 - 
comparepublic abstract int compare(XMLGregorianCalendar xmlGregorianCalendar) Compare two instances of W3C XML Schema 1.0 date/time datatypes according to partial order relation defined in W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime.xsd:dateTimedatatype field mapping to accessors of this class are defined in date/time field mapping table.- Parameters:
- xmlGregorianCalendar- Instance of- XMLGregorianCalendarto compare
- Returns:
- The relationship between thisXMLGregorianCalendarand the specifiedxmlGregorianCalendarasDatatypeConstants.LESSER,DatatypeConstants.EQUAL,DatatypeConstants.GREATERorDatatypeConstants.INDETERMINATE.
- Throws:
- NullPointerException- if- xmlGregorianCalendaris null.
 
 - 
normalizepublic abstract XMLGregorianCalendar normalize() Normalize this instance to UTC.2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z Implements W3C XML Schema Part 2, Section 3.2.7.3 (A). - Returns:
- this- XMLGregorianCalendarnormalized to UTC.
 
 - 
equalspublic boolean equals(Object obj) Compares this calendar to the specified object. The result istrueif and only if the argument is not null and is anXMLGregorianCalendarobject that represents the same instant in time as this object.- Overrides:
- equalsin class- Object
- Parameters:
- obj- to compare.
- Returns:
- truewhen- objis an instance of- XMLGregorianCalendarand- compare(XMLGregorianCalendar obj)returns- DatatypeConstants.EQUAL, otherwise- false.
- See Also:
- Object.hashCode(),- HashMap
 
 - 
hashCodepublic int hashCode() Returns a hash code consistent with the definition of the equals method.- Overrides:
- hashCodein class- Object
- Returns:
- hash code of this object.
- See Also:
- Object.equals(java.lang.Object),- System.identityHashCode(java.lang.Object)
 
 - 
toXMLFormatpublic abstract String toXMLFormat() Return the lexical representation ofthisinstance. The format is specified in XML Schema 1.0 Part 2, Section 3.2.[7-14].1, Lexical Representation".Specific target lexical representation format is determined by getXMLSchemaType().- Returns:
- XML, as String, representation of thisXMLGregorianCalendar
- Throws:
- IllegalStateException- if the combination of set fields does not match one of the eight defined XML Schema builtin date/time datatypes.
 
 - 
getXMLSchemaTypepublic abstract QName getXMLSchemaType() Return the name of the XML Schema date/time type that this instance maps to. Type is computed based on fields that are set.Required fields for XML Schema 1.0 Date/Time Datatypes. 
 (timezone is optional for all date/time datatypes)Datatype year month day hour minute second DatatypeConstants.DATETIMEX X X X X X DatatypeConstants.DATEX X X DatatypeConstants.TIMEX X X DatatypeConstants.GYEARMONTHX X DatatypeConstants.GMONTHDAYX X DatatypeConstants.GYEARX DatatypeConstants.GMONTHX DatatypeConstants.GDAYX - Returns:
- One of the following class constants:
   DatatypeConstants.DATETIME,DatatypeConstants.TIME,DatatypeConstants.DATE,DatatypeConstants.GYEARMONTH,DatatypeConstants.GMONTHDAY,DatatypeConstants.GYEAR,DatatypeConstants.GMONTHorDatatypeConstants.GDAY.
- Throws:
- IllegalStateException- if the combination of set fields does not match one of the eight defined XML Schema builtin date/time datatypes.
 
 - 
toStringpublic String toString() Returns aStringrepresentation of thisXMLGregorianCalendarObject.The result is a lexical representation generated by toXMLFormat().- Overrides:
- toStringin class- Object
- Returns:
- A non-nullvalidStringrepresentation of thisXMLGregorianCalendar.
- Throws:
- IllegalStateException- if the combination of set fields does not match one of the eight defined XML Schema builtin date/time datatypes.
- See Also:
- toXMLFormat()
 
 - 
isValidpublic abstract boolean isValid() Validate instance bygetXMLSchemaType()constraints.- Returns:
- true if data values are valid.
 
 - 
addpublic abstract void add(Duration duration) Adddurationto this instance.The computation is specified in XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes. date/time field mapping table defines the mapping from XML Schema 1.0 dateTimefields to this class' representation of those fields.- Parameters:
- duration- Duration to add to this- XMLGregorianCalendar.
- Throws:
- NullPointerException- when- durationparameter is- null.
 
 - 
toGregorianCalendarpublic abstract GregorianCalendar toGregorianCalendar() Convert thisXMLGregorianCalendarto aGregorianCalendar.When thisinstance has an undefined field, this conversion relies on thejava.util.GregorianCalendardefault for its corresponding field. A notable difference between XML Schema 1.0 date/time datatypes andjava.util.GregorianCalendaris that Timezone value is optional for date/time datatypes and it is a required field forjava.util.GregorianCalendar. See javadoc forjava.util.TimeZone.getDefault()on how the default is determined. To explicitly specify theTimeZoneinstance, seetoGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar).
 * designates possible loss of precision during the conversion due to source datatype having higher precision than target datatype.Field by Field Conversion from this class to java.util.GregorianCalendarjava.util.GregorianCalendarfieldjavax.xml.datatype.XMLGregorianCalendarfieldERAgetEonAndYear().signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.ADYEARgetEonAndYear().abs().intValue()*MONTHgetMonth()-DatatypeConstants.JANUARY+Calendar.JANUARYDAY_OF_MONTHgetDay()HOUR_OF_DAYgetHour()MINUTEgetMinute()SECONDgetSecond()MILLISECONDget millisecond order from getFractionalSecond()*GregorianCalendar.setTimeZone(TimeZone)getTimezone()formatted into Custom timezone idTo ensure consistency in conversion implementations, the new GregorianCalendarshould be instantiated in following manner.- Using timeZonevalue as defined above, create a newjava.util.GregorianCalendar(timeZone,Locale.getDefault()).
- Initialize all GregorianCalendar fields by calling Calendar.clear().
- Obtain a pure Gregorian Calendar by invoking
   GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE)).
- Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY,
       MINUTE, SECOND and MILLISECOND are set using the method
       Calendar.set(int,int)
 - Returns:
- An instance of GregorianCalendar.
- See Also:
- toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)
 
- Using 
 - 
toGregorianCalendarpublic abstract GregorianCalendar toGregorianCalendar(TimeZone timezone, Locale aLocale, XMLGregorianCalendar defaults) Convert thisXMLGregorianCalendaralong with provided parameters to aGregorianCalendarinstance.Since XML Schema 1.0 date/time datetypes has no concept of timezone ids or daylight savings timezone ids, this conversion operation allows the user to explicitly specify one with timezoneparameter.To compute the return value's TimeZonefield,- when parameter timeZoneis non-null, it is the timezone field.
- else when this.getTimezone() != FIELD_UNDEFINED, create ajava.util.TimeZonewith a custom timezone id using thethis.getTimezone().
- else when defaults.getTimezone() != FIELD_UNDEFINED, create ajava.util.TimeZonewith a custom timezone id usingdefaults.getTimezone().
- else use the GregorianCalendardefault timezone value for the host is defined as specified byjava.util.TimeZone.getDefault().
 To ensure consistency in conversion implementations, the new GregorianCalendarshould be instantiated in following manner.- Create a new java.util.GregorianCalendar(TimeZone, Locale)with TimeZone set as specified above and theLocaleparameter.
- Initialize all GregorianCalendar fields by calling Calendar.clear()
- Obtain a pure Gregorian Calendar by invoking
   GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE)).
- Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY,
       MINUTE, SECOND and MILLISECOND are set using the method
       Calendar.set(int,int)
 - Parameters:
- timezone- provide Timezone.- nullis a legal value.
- aLocale- provide explicit Locale. Use default GregorianCalendar locale if value is- null.
- defaults- provide default field values to use when corresponding field for this instance is FIELD_UNDEFINED or null. If- defaultsis- nullor a field within the specified- defaultsis undefined, just use- java.util.GregorianCalendardefaults.
- Returns:
- a java.util.GregorianCalendar conversion of this instance.
 
- when parameter 
 - 
getTimeZonepublic abstract TimeZone getTimeZone(int defaultZoneoffset) Returns ajava.util.TimeZonefor this class.If timezone field is defined for this instance, returns TimeZone initialized with custom timezone id of zoneoffset. If timezone field is undefined, try the defaultZoneoffset that was passed in. If defaultZoneoffset is FIELD_UNDEFINED, return default timezone for this host. (Same default as java.util.GregorianCalendar). - Parameters:
- defaultZoneoffset- default zoneoffset if this zoneoffset is- DatatypeConstants.FIELD_UNDEFINED.
- Returns:
- TimeZone for this.
 
 
- 
 
-