Package java.util

Class GregorianCalendar

    • Field Detail

      • BC

        public static final int BC
        Value of the ERA field indicating the period before the common era (before Christ), also known as BCE. The sequence of years at the transition from BC to AD is ..., 2 BC, 1 BC, 1 AD, 2 AD,...
        See Also:
        Calendar.ERA, Constant Field Values
      • AD

        public static final int AD
        Value of the ERA field indicating the common era (Anno Domini), also known as CE. The sequence of years at the transition from BC to AD is ..., 2 BC, 1 BC, 1 AD, 2 AD,...
        See Also:
        Calendar.ERA, Constant Field Values
    • Constructor Detail

      • GregorianCalendar

        public GregorianCalendar()
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in class Calendar
      • computeFields

        public void computeFields()
      • computeTime

        public void computeTime()
      • setTime

        public void setTime​(Date date)
        Description copied from class: Calendar
        Sets this Calendar's time with the given Date.

        Note: Calling setTime() with Date(Long.MAX_VALUE) or Date(Long.MIN_VALUE) may yield incorrect field values from get().

        Specified by:
        setTime in class Calendar
        Parameters:
        date - the given Date.
        See Also:
        Calendar.getTime(), Calendar.setTimeInMillis(long)
      • get

        public int get​(int field)
        Specified by:
        get in class Calendar
      • set

        public void set​(int field,
                        int value)
        Description copied from class: Calendar
        Sets the given calendar field to the given value. The value is not interpreted by this method regardless of the leniency mode.
        Specified by:
        set in class Calendar
        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)
      • add

        public void add​(int field,
                        int value)
        Specified by:
        add in class Calendar