Package java.util
Class GregorianCalendar
- java.lang.Object
-
- java.util.Calendar
-
- java.util.GregorianCalendar
-
-
Field Summary
Fields Modifier and Type Field Description static intADValue of theERAfield indicating the common era (Anno Domini), also known as CE.static intBCValue of theERAfield indicating the period before the common era (before Christ), also known as BCE.protected static longONE_DAY-
Fields inherited from class java.util.Calendar
AM, AM_PM, APRIL, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, ERA, FEBRUARY, FRIDAY, HOUR, HOUR_OF_DAY, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR
-
-
Constructor Summary
Constructors Constructor Description GregorianCalendar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int field, int value)voidclear()Objectclone()voidcomputeFields()voidcomputeTime()intget(int field)DategetTime()longgetTimeInMillis()Returns this Calendar's time value in milliseconds.voidset(int field, int value)Sets the given calendar field to the given value.voidsetTime(Date date)Sets this Calendar's time with the givenDate.voidsetTimeInMillis(long millis)Sets this Calendar's current time from the given long value.-
Methods inherited from class java.util.Calendar
after, before, compareTo, equals, getActualMaximum, getActualMinimum, getFirstDayOfWeek, getInstance, getMinimalDaysInFirstWeek, isLenient, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek
-
-
-
-
Field Detail
-
BC
public static final int BC
Value of theERAfield indicating the period before the common era (before Christ), also known as BCE. The sequence of years at the transition fromBCtoADis ..., 2 BC, 1 BC, 1 AD, 2 AD,...- See Also:
Calendar.ERA, Constant Field Values
-
AD
public static final int AD
Value of theERAfield indicating the common era (Anno Domini), also known as CE. The sequence of years at the transition fromBCtoADis ..., 2 BC, 1 BC, 1 AD, 2 AD,...- See Also:
Calendar.ERA, Constant Field Values
-
ONE_DAY
protected static final long ONE_DAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
computeFields
public void computeFields()
-
computeTime
public void computeTime()
-
getTime
public Date getTime()
Description copied from class:Calendar- Specified by:
getTimein classCalendar- Returns:
- a
Daterepresenting the time value. - See Also:
Calendar.setTime(Date),Calendar.getTimeInMillis()
-
setTime
public void setTime(Date date)
Description copied from class:CalendarSets this Calendar's time with the givenDate.Note: Calling
setTime()withDate(Long.MAX_VALUE)orDate(Long.MIN_VALUE)may yield incorrect field values fromget().- Specified by:
setTimein classCalendar- Parameters:
date- the given Date.- See Also:
Calendar.getTime(),Calendar.setTimeInMillis(long)
-
setTimeInMillis
public void setTimeInMillis(long millis)
Description copied from class:CalendarSets this Calendar's current time from the given long value.- Specified by:
setTimeInMillisin classCalendar- Parameters:
millis- the new time in UTC milliseconds from the epoch.- See Also:
Calendar.setTime(Date),Calendar.getTimeInMillis()
-
getTimeInMillis
public long getTimeInMillis()
Description copied from class:CalendarReturns this Calendar's time value in milliseconds.- Specified by:
getTimeInMillisin classCalendar- Returns:
- the current time as UTC milliseconds from the epoch.
- See Also:
Calendar.getTime(),Calendar.setTimeInMillis(long)
-
set
public void set(int field, int value)Description copied from class:CalendarSets the given calendar field to the given value. The value is not interpreted by this method regardless of the leniency mode.- Specified by:
setin classCalendar- Parameters:
field- the given calendar field.value- the value to be set for the given calendar field.- See Also:
#set(int,int,int),#set(int,int,int,int,int),#set(int,int,int,int,int,int),Calendar.get(int)
-
-