Obtains an instance of MonthDay
from a temporal object.
Obtains an instance of MonthDay
from a temporal object.
A TemporalAccessor
represents some form of date and time information.
This factory converts the arbitrary temporal object to an instance of MonthDay
.
The conversion extracts the MONTH_OF_YEAR
and
DAY_OF_MONTH
fields.
The extraction is only permitted if the date-time has an ISO chronology.
This method matches the signature of the functional interface TemporalQuery
allowing it to be used in queries via method reference, MonthDay::from
.
the temporal object to convert, not null
the month-day, not null
DateTimeException
if unable to convert to a { @code MonthDay}
Obtains the current month-day from the specified clock.
Obtains the current month-day from the specified clock.
This will query the specified clock to obtain the current month-day.
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using dependency injection
.
the clock to use, not null
the current month-day, not null
Obtains the current month-day from the system clock in the specified time-zone.
Obtains the current month-day from the system clock in the specified time-zone.
This will query the system clock
to obtain the current month-day.
Specifying the time-zone avoids dependence on the default time-zone.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
the zone ID to use, not null
the current month-day using the system clock, not null
Obtains the current month-day from the system clock in the default time-zone.
Obtains the current month-day from the system clock in the default time-zone.
This will query the system clock
in the default
time-zone to obtain the current month-day.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
the current month-day using the system clock and default time-zone, not null
Obtains an instance of MonthDay
.
Obtains an instance of MonthDay
.
The day-of-month must be valid for the month within a leap year. Hence, for month 2 (February), day 29 is valid.
For example, passing in month 4 (April) and day 31 will throw an exception, as there can never be April 31st in any year. By contrast, passing in February 29th is permitted, as that month-day can sometimes be valid.
the month-of-year to represent, from 1 (January) to 12 (December)
the day-of-month to represent, from 1 to 31
the month-day, not null
DateTimeException
if the day-of-month is invalid for the month
Obtains an instance of MonthDay
.
Obtains an instance of MonthDay
.
The day-of-month must be valid for the month within a leap year. Hence, for February, day 29 is valid.
For example, passing in April and day 31 will throw an exception, as there can never be April 31st in any year. By contrast, passing in February 29th is permitted, as that month-day can sometimes be valid.
the month-of-year to represent, not null
the day-of-month to represent, from 1 to 31
the month-day, not null
DateTimeException
if the day-of-month is invalid for the month
Obtains an instance of MonthDay
from a text string using a specific formatter.
Obtains an instance of MonthDay
from a text string using a specific formatter.
The text is parsed using the formatter, returning a month-day.
the text to parse, not null
the formatter to use, not null
the parsed month-day, not null
DateTimeParseException
if the text cannot be parsed
Obtains an instance of MonthDay
from a text string such as --12-03
.
Obtains an instance of MonthDay
from a text string such as --12-03
.
The string must represent a valid month-day.
The format is --MM-dd
.
the text to parse such as "--12-03", not null
the parsed month-day, not null
DateTimeParseException
if the text cannot be parsed