Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 712
نمايش فراداده

GregorianCalendarjava.util

Java 1.1cloneable serializable comparable

This concrete subclass of Calendar implements the standard solar calendar with years numbered from the birth of Christ that is used is most locales throughout the world. You do not typically use this class directly, but instead obtain a Calendar object suitable for the default locale by calling Calendar.getInstance( ). See Calendar for details on working with Calendar objects. There is a discontinuity in the Gregorian calendar that represents the historical switch from the Julian calendar to the Gregorian calendar. By default, GregorianCalendar assumes that this switch occurs on October 15, 1582. Most programs need not be concerned with the switch.

Figure 16-23. java.util.GregorianCalendar

public class

GregorianCalendar extends Calendar { // Public Constructors public

GregorianCalendar ( ); public

GregorianCalendar (Locale

aLocale ); public

GregorianCalendar (TimeZone

zone ); public

GregorianCalendar (TimeZone

zone , Locale

aLocale ); public

GregorianCalendar (int

year , int

month , int

dayOfMonth ); public

GregorianCalendar (int

year , int

month , int

dayOfMonth , int

hourOfDay , int

minute ); public

GregorianCalendar (int

year , int

month , int

dayOfMonth , int

hourOfDay , int

minute , int

second ); // Public Constants public static final int

AD ; =1 public static final int

BC ; =0 // Public Instance Methods public final Date

getGregorianChange ( ); public boolean

isLeapYear (int

year ); public void

setGregorianChange (Date

date ); // Public Methods Overriding Calendar public void

add (int

field , int

amount );

5.0 public Object

clone ( ); public boolean

equals (Object

obj );

1.2 public int

getActualMaximum (int

field );

1.2 public int

getActualMinimum (int

field ); public int

getGreatestMinimum (int

field ); public int

getLeastMaximum (int

field ); public int

getMaximum (int

field ); public int

getMinimum (int

field );

5.0 public TimeZone

getTimeZone ( ); public int

hashCode ( ); public void

roll (int

field , boolean

up );

1.2 public void

roll (int

field , int

amount );

5.0 public void

setTimeZone (TimeZone

zone ); // Protected Methods Overriding Calendar protected void

computeFields ( ); protected void

computeTime ( ); }

Passed To

javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar( )

Returned By

javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar( )