I wish to remove the Joda-Time library from my project.
I am trying to convert a two digit year to full year. The following code from Joda-Time can fulfil the purpos
The problem is that you can't parse a year on its own into a LocalDate. A LocalDate needs more information than that.
You can use the parse method of the formatter, which will give you a TemporalAccessor, and then get the year field from that:
int year = TWO_YEAR_FORMATTER.parse("99").get(ChronoField.YEAR);
System.out.println(year);
Addressing the discrepancy between the two: these are two distinct APIs. Yes, they are very similar, and the java.time package was informed by design decisions of JodaTime, but it was never intended to be a drop-in replacement for it.
See this answer if you would like to change the pivot year (by default '99' will resolve to 2099 and not 1999).