MonthDay parse(CharSequence text) example

Description

MonthDay parse(CharSequence text) creates 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.

Syntax

parse has the following syntax.


public static MonthDay parse(CharSequence text)

Example

The following example shows how to use parse.


import java.time.MonthDay;
//  w  ww.  j  a  v a  2  s. c  om
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.parse("--12-03");

    System.out.println(m);

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset