目录

java.time - MonthDay

介绍 (Introduction)

java.time.MonthDay类表示ISO- java.time.MonthDay - 日,例如 - 12-03。

类声明

以下是java.time.MonthDay类的声明 -

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

类方法

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

调整指定的时间对象以具有此月 - 日。

2 LocalDate atYear(int year)

将此月 - 日与一年组合以创建LocalDate。

3 int compareTo(MonthDay other)

将这个月份的日期与另一个月份的日期进行比较。

4 boolean equals(Object obj)

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

5 String format(DateTimeFormatter formatter)

使用指定的格式化程序在本月创建格式。

6 static MonthDay from(TemporalAccessor temporal)

从时态对象获取MonthDay的实例。

7 int get(TemporalField field)

获取此月 - 日指定字段的值作为int。

8 int getDayOfMonth()

获取日期字段。

9 long getLong(TemporalField field)

从此时间为long获取指定字段的值。

10 Month getMonth()

使用Month枚举获取月份字段。

11 int getMonthValue()

获取1到12之间的月份字段。

12 int hashCode()

这个月的哈希码。

13 boolean isAfter(MonthDay other)

检查此月 - 日是否在指定的月 - 日之后。

14 boolean isBefore(MonthDay other)

检查此月 - 日是否在指定的月 - 日之前。

15 boolean isSupported(TemporalField field)

检查是否支持指定的字段。

16 boolean isSupported(TemporalUnit unit)

检查指定的单元是否受支持。

17 boolean isValidYear(int year)

检查年份是否适用于本月。

18 static MonthDay now()

在默认时区中从系统时钟获取当前时间。

19 static MonthDay now(Clock clock)

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

20 static MonthDay now(ZoneId zone)

从指定时区的系统时钟获取当前时间。

21 static MonthDay of(int month, int dayOfMonth)

获得MonthDay的实例。

22 static MonthDay of(Month month, int dayOfMonth)

获得MonthDay的实例。

23 static MonthDay parse(CharSequence text)

从文本字符串(例如 - 12-03)获取MonthDay的实例。

24 static MonthDay parse(CharSequence text, DateTimeFormatter formatter)

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

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

这次使用指定的查询进行查询。

26 ValueRange range(TemporalField field)

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

27 String toString()

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

28 MonthDay with(Month month)

返回此MonthDay的副本,其中月份已更改。

29 MonthDay withDayOfMonth(int dayOfMonth)

返回此MonthDay的副本,并更改​​日期。

30 MonthDay withMonth(int month)

返回此MonthDay的副本,其中月份已更改。

方法继承

该类继承以下类中的方法 -

  • Java.lang.Object
↑回到顶部↑
WIKI教程 @2018