Uses of Class
java.util.Calendar
Packages that useCalendar Package Description java.sql Provides the API for accessing and processing data stored in adata source (usually a relational database) using theJava™ programming language.java.text Provides classes and interfaces for handling text, dates, numbers, and messages in a manner independent of natural languages.java.util Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes.javax.sql Provides the API for server side data source access and processing fromthe Java™ programming language.javax.sql.rowset Standard interfaces and base classes for JDBCRowSetimplementations.javax.xml.datatype Defines XML/Java Type Mappings.Uses ofCalendar injava.sql
Methods injava.sql with parameters of typeCalendar Modifier and Type Method Description DateCallableStatement. getDate(int parameterIndex,Calendar cal)Retrieves the value of the designated JDBCDATEparameter as ajava.sql.Dateobject, using the givenCalendarobject to construct the date.DateCallableStatement. getDate(String parameterName,Calendar cal)Retrieves the value of a JDBCDATEparameter as ajava.sql.Dateobject, using the givenCalendarobject to construct the date.DateResultSet. getDate(int columnIndex,Calendar cal)Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Dateobject in the Java programming language.DateResultSet. getDate(String columnLabel,Calendar cal)Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Dateobject in the Java programming language.TimeCallableStatement. getTime(int parameterIndex,Calendar cal)Retrieves the value of the designated JDBCTIMEparameter as ajava.sql.Timeobject, using the givenCalendarobject to construct the time.TimeCallableStatement. getTime(String parameterName,Calendar cal)Retrieves the value of a JDBCTIMEparameter as ajava.sql.Timeobject, using the givenCalendarobject to construct the time.TimeResultSet. getTime(int columnIndex,Calendar cal)Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timeobject in the Java programming language.TimeResultSet. getTime(String columnLabel,Calendar cal)Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timeobject in the Java programming language.TimestampCallableStatement. getTimestamp(int parameterIndex,Calendar cal)Retrieves the value of the designated JDBCTIMESTAMPparameter as ajava.sql.Timestampobject, using the givenCalendarobject to construct theTimestampobject.TimestampCallableStatement. getTimestamp(String parameterName,Calendar cal)Retrieves the value of a JDBCTIMESTAMPparameter as ajava.sql.Timestampobject, using the givenCalendarobject to construct theTimestampobject.TimestampResultSet. getTimestamp(int columnIndex,Calendar cal)Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timestampobject in the Java programming language.TimestampResultSet. getTimestamp(String columnLabel,Calendar cal)Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timestampobject in the Java programming language.voidCallableStatement. setDate(String parameterName,Date x,Calendar cal)Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidPreparedStatement. setDate(int parameterIndex,Date x,Calendar cal)Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidCallableStatement. setTime(String parameterName,Time x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidPreparedStatement. setTime(int parameterIndex,Time x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidCallableStatement. setTimestamp(String parameterName,Timestamp x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.voidPreparedStatement. setTimestamp(int parameterIndex,Timestamp x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.Uses ofCalendar injava.text
Fields injava.text declared asCalendar Modifier and Type Field Description protectedCalendarDateFormat. calendarTheCalendarinstance used for calculating the date-time fields and the instant of time.Methods injava.text that returnCalendar Modifier and Type Method Description CalendarDateFormat. getCalendar()Gets the calendar associated with this date/time formatter.Methods injava.text with parameters of typeCalendar Modifier and Type Method Description voidDateFormat. setCalendar(Calendar newCalendar)Set the calendar to be used by this date format.Uses ofCalendar injava.util
Subclasses ofCalendar injava.util Modifier and Type Class Description classGregorianCalendarGregorianCalendaris a concrete subclass ofCalendarand provides the standard calendar system used by most of the world.Methods injava.util that returnCalendar Modifier and Type Method Description CalendarCalendar.Builder. build()Returns aCalendarbuilt from the parameters set by the setter methods.staticCalendarCalendar. getInstance()Gets a calendar using the default time zone and locale.staticCalendarCalendar. getInstance(Locale aLocale)Gets a calendar using the default time zone and specified locale.staticCalendarCalendar. getInstance(TimeZone zone)Gets a calendar using the specified time zone and default locale.staticCalendarCalendar. getInstance(TimeZone zone,Locale aLocale)Gets a calendar with the specified time zone and locale.Methods injava.util with parameters of typeCalendar Modifier and Type Method Description intCalendar. compareTo(Calendar anotherCalendar)Compares the time values (millisecond offsets from theEpoch) represented by twoCalendarobjects.Uses ofCalendar injavax.sql
Methods injavax.sql with parameters of typeCalendar Modifier and Type Method Description voidRowSet. setDate(int parameterIndex,Date x,Calendar cal)Sets the designated parameter in thisRowSetobject's command with the givenjava.sql.Datevalue.voidRowSet. setDate(String parameterName,Date x,Calendar cal)Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidRowSet. setTime(int parameterIndex,Time x,Calendar cal)Sets the designated parameter in thisRowSetobject's command with the givenjava.sql.Timevalue.voidRowSet. setTime(String parameterName,Time x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidRowSet. setTimestamp(int parameterIndex,Timestamp x,Calendar cal)Sets the designated parameter in thisRowSetobject's command with the givenjava.sql.Timestampvalue.voidRowSet. setTimestamp(String parameterName,Timestamp x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.Uses ofCalendar injavax.sql.rowset
Methods injavax.sql.rowset with parameters of typeCalendar Modifier and Type Method Description voidBaseRowSet. setDate(int parameterIndex,Date x,Calendar cal)Sets the designated parameter to the givenjava.sql.Dateobject.voidBaseRowSet. setDate(String parameterName,Date x,Calendar cal)Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidBaseRowSet. setTime(int parameterIndex,Time x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timeobject.voidBaseRowSet. setTime(String parameterName,Time x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidBaseRowSet. setTimestamp(int parameterIndex,Timestamp x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampobject.voidBaseRowSet. setTimestamp(String parameterName,Timestamp x,Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.Uses ofCalendar injavax.xml.datatype
Methods injavax.xml.datatype with parameters of typeCalendar Modifier and Type Method Description abstract voidDuration. addTo(Calendar calendar)Adds this duration to aCalendarobject.longDuration. getTimeInMillis(Calendar startInstant)Returns the length of the duration in milli-seconds.abstractDurationDuration. normalizeWith(Calendar startTimeInstant)Converts the years and months fields into the days field by using a specific time instant as the reference point.