java.time.MonthDay类

简介

java.time.MonthDay 类表示ISO-8601日历系统中的月 - 日,例如 -  12-03.

类声明

以下是 java.time.MonthDay class :

public final class MonthDay
   extends Object
      implements TemporalAccessor, TemporalAdjuster, Comparable<MonthDay>, Serializable

类方法

Sr .No.方法&描述
1Temporal adjustInto(Temporal temporal)

调整指定的时间对象以包含此月 - 日.

2LocalDate atYear(int year)

将此月 - 日与一年合并以创建LocalDate.

3int compareTo(MonthDay other)

比较这个月 - 日与另一个月 -

4boolean equals(Object obj)

检查这个月 - 日是否等于另一个月 -

5String format(DateTimeFormatter formatter)

使用指定的格式化程序格式化本月 -

6static MonthDay from(TemporalAccessor temporal)

获取实例来自临时对象的MonthDay.

7int get(TemporalField field)

从本月获取指定字段的值 - day as int.

8int getDayOfMonth()

获取日期字段.

9long getLong(TemporalField field)

从此时间开始获取指定字段的值为long.

10Month getMonth()

使用月枚举获取月份字段.

11int getMonthValue ()

获取1到12之间的年份字段.

12int hashCode()

这个月 - 日的哈希码.

13boolean isAfter(MonthDay other)

检查这是否月日是一个指定的月 - 日.

14boolean isBefore(MonthDay other)

检查此月日是否在指定月份之前-day.

15boolean isSupported(TemporalField field)

检查指定的字段是否受支持.

16boolean isSupported(TemporalUnit unit)

检查指定的单位是否受支持.

17boolean isValidYear (int year)

检查这个月的年份是否有效.

18static MonthDay now()

从默认时区中的系统时钟获取当前时间.

19static MonthDay now(Clock clock)

从指定的时钟获得当前时间.

20static MonthDay now(ZoneId zone)

从指定时区的系统时钟获得当前时间.

21static MonthDay of(int month, int dayOfMonth)

获得MonthDay的实例.

22static MonthDay of(Month month, int dayOfMonth)

获取MonthDay的实例.

23static MonthDay parse(CharSequence text)

从文本字符串中获取MonthDay实例,例如--12-03.

24static MonthDay parse(CharSequence text,DateTimeFormatter formatter)

使用特定的格式化程序从文本字符串中获取MonthDay的实例.

25<R> R query(TemporalQuery<R> query)

使用指定的查询查询此次.

26ValueRange range(TemporalField field)

获取指定字段的有效值范围.

27String toString()

将此日期输出为字符串,例如--12-03.

28MonthDay with(Month month)

返回每月更改的月份日的副本.

29MonthDay withDayOfMonth(int dayOfMonth)

返回ac这个月的日期和日期的变化.

30MonthDay withMonth(int month)

返回此副本月日变更年月.

继承的方法

此类继承以下类中的方法 :

  • Java.lang.Object