📜  java.time.Month枚举

📅  最后修改于: 2020-11-14 10:50:01             🧑  作者: Mango


介绍

java.time.Month枚举表示每年的一个月,例如’July’。

类声明

以下是java.time.Month枚举的声明-

public enum Month
   extends Enum
      implements TemporalAccessor, TemporalAdjuster

枚举常量

以下是Java.time.Month枚举的字段-

  • 一月– 1月份共有31天的月份的单一实例。

  • 2月2月的单例实例,具有28天,或a年中的29天。

  • 3月-3月的31天内的单例实例。

  • 4月-具有30天的4月月份的单例实例。

  • 5月-5月的31个天的单例实例。

  • JUNE -六月份的30天月的单一实例。

  • 7月-7月的31天的单例实例。

  • 8月-8月的31天的单例实例。

  • 9月-9月的30天的单例实例。

  • 十月-十月中有31天的单例实例。

  • 十一月-十一月份的30天月的单一实例。

  • 十二月-具有31天的12月月份的单例实例。

枚举方法

Sr.No. Method & Description
1 Temporal adjustInto(Temporal temporal)

Adjusts the specified temporal object to have the same month-of-year as this object.

2 int firstDayOfYear(boolean leapYear)

Gets the day-of-year corresponding to the first day of this month.

3 Month firstMonthOfQuarter()

Gets the month corresponding to the first month of this quarter.

4 static Month from(TemporalAccessor temporal)

Obtains an instance of Month from a temporal object.

5 int get(TemporalField field)

Gets the value of the specified field from this month-of-year as an int.

6 String getDisplayName(TextStyle style, Locale locale)

Gets the textual representation, such as ‘Jan’ or ‘December’.

7 long getLong(TemporalField field)

Gets the value of the specified field from this month-of-year as a long.

8 int getValue()

Gets the month-of-year int value.

9 boolean isSupported(TemporalField field)

Checks if the specified field is supported.

10 int length(boolean leapYear)

Gets the length of this month in days.

11 int maxLength()

Gets the maximum length of this month in days.

12 int minLength()

Gets the minimum length of this month in days.

13 Month minus(long months)

Returns the month-of-year that is the specified number of months before this one.

14 static Month of(int month)

Obtains an instance of Month from an int value.

15 Month plus(long months)

Returns the month-of-year that is the specified number of quarters after this one.

16 R query(TemporalQuery query)

Queries this offset using the specified query.

17 ValueRange range(TemporalField field)

Gets the range of valid values for the specified field.

18 static Month valueOf(String name)

Returns the enum constant of this type with the specified name.

19 static Month[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

方法继承

此类从以下类继承方法-

  • Java.lang.Enum
  • Java.lang.Object