The java.time.MonthDay class represents a month-day in the ISO-8601 calendar system, such as --12-03.
Following is the declaration for java.time.MonthDay class −
public final class MonthDay extends Object implements TemporalAccessor, TemporalAdjuster, Comparable<MonthDay>, Serializable
Sr.No. | Method & Description |
---|---|
1 | Temporal adjustInto(Temporal temporal)
Adjusts the specified temporal object to have this month-day. |
2 | LocalDate atYear(int year)
Combines this month-day with a year to create a LocalDate. |
3 | int compareTo(MonthDay other)
Compares this month-day to another month-day. |
4 | boolean equals(Object obj)
Checks if this month-day is equal to another month-day. |
5 | String format(DateTimeFormatter formatter)
Formats this month-day using the specified formatter. |
6 | static MonthDay from(TemporalAccessor temporal)
Obtains an instance of MonthDay from a temporal object. |
7 | int get(TemporalField field)
Gets the value of the specified field from this month-day as an int. |
8 | int getDayOfMonth()
Gets the day-of-month field. |
9 | long getLong(TemporalField field)
Gets the value of the specified field from this time as a long. |
10 | Month getMonth()
Gets the month-of-year field using the Month enum. |
11 | int getMonthValue()
Gets the month-of-year field from 1 to 12. |
12 | int hashCode()
A hash code for this month-day. |
13 | boolean isAfter(MonthDay other)
Checks if this month-day is after the specified month-day. |
14 | boolean isBefore(MonthDay other)
Checks if this month-day is before the specified month-day. |
15 | boolean isSupported(TemporalField field)
Checks if the specified field is supported. |
16 | boolean isSupported(TemporalUnit unit)
Checks if the specified unit is supported. |
17 | boolean isValidYear(int year)
Checks if the year is valid for this month-day. |
18 | static MonthDay now()
Obtains the current time from the system clock in the default time-zone. |
19 | static MonthDay now(Clock clock)
Obtains the current time from the specified clock. |
20 | static MonthDay now(ZoneId zone)
Obtains the current time from the system clock in the specified time-zone. |
21 | static MonthDay of(int month, int dayOfMonth)
Obtains an instance of MonthDay. |
22 | static MonthDay of(Month month, int dayOfMonth)
Obtains an instance of MonthDay. |
23 | static MonthDay parse(CharSequence text)
Obtains an instance of MonthDay from a text string such as --12-03. |
24 | static MonthDay parse(CharSequence text, DateTimeFormatter formatter)
Obtains an instance of MonthDay from a text string using a specific formatter. |
25 | <R> R query(TemporalQuery<R> query)
Queries this time using the specified query. |
26 | ValueRange range(TemporalField field)
Gets the range of valid values for the specified field. |
27 | String toString()
Outputs this date as a String, such as --12-03. |
28 | MonthDay with(Month month)
Returns a copy of this MonthDay with the month-of-year altered. |
29 | MonthDay withDayOfMonth(int dayOfMonth)
Returns a copy of this MonthDay with the day-of-month altered. |
30 | MonthDay withMonth(int month)
Returns a copy of this MonthDay with the month-of-year altered. |
This class inherits methods from the following classes −