When googling this, I came across many answers - hence the question.
What is the correct way to parse any xsd:date
to a LocalDate
in Java?
Here are the ways I have come up with (from googling):
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(str)
.toGregorianCalendar()
.toZonedDateTime()
.toLocalDate()
Another:
DatatypeConverter.parseDate(str)
.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate()
Or perhaps I should be doing something different altogether?