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

類方法

序號 方法及描述
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
廣告