java.time.MonthDay类

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

类声明

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

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

Java

类方法

编号方法描述
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)获取此月-日指定字段的int值。
8int getDayOfMonth()获取日期字段。
9long getLong(TemporalField field)从此时间为long获取指定字段的值。
10Month getMonth()使用Month枚举获取月份字段。
11int getMonthValue()获取112之间的月份字段。
12int hashCode()这个月的哈希码。
13boolean isAfter(MonthDay other)检查此月-日是否在指定的月-日之后。
14boolean isBefore(MonthDay other)检查此月-日是否在指定的月-日之前。
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)从文本字符串(例如:12-03)获取MonthDay的实例。
24static MonthDay parse(CharSequence text, DateTimeFormatter formatter)使用特定格式化程序从文本字符串中获取MonthDay的实例。
25R query(TemporalQuery query)使用指定的查询进行查询。
26ValueRange range(TemporalField field)获取指定字段的有效值范围。
27String toString()将此日期输出为字符串,例如:12-03
28MonthDay with(Month month)返回此MonthDay的副本,其中月份已更改。
29MonthDay withDayOfMonth(int dayOfMonth)返回此MonthDay的副本,并更改日期。
30MonthDay withMonth(int month)返回此MonthDay的副本,其中月份已更改。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智慧浩海

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值