MonthDay parse(CharSequence text, DateTimeFormatter formatter)
creates an instance of MonthDay from a text string using a specific formatter.
parse
has the following syntax.
public static MonthDay parse(CharSequence text, DateTimeFormatter formatter)
The following example shows how to use parse
.
import java.time.MonthDay; import java.time.format.DateTimeFormatter; /* w w w.j av a 2 s . co m*/ public class Main { public static void main(String[] args) { MonthDay m = MonthDay.parse("10 10",DateTimeFormatter.ofPattern("M dd")); System.out.println(m); } }
The code above generates the following result.