I'm trying to create a LocalDate object, using the JodaTime library, from an input string. The string comes from a database that I have no control over. The input date of birth looks exactly like this:
1963-07-19T00:00:00.000+0000
I just want the 1963-07-19
portion, I don't want the time portion. So I tried to implement a formatter like so:
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
And then create the LocalDate object like so:
LocalDate dob = formatter.parseLocalDate(dateOfBirth);
But I get the error:
Invalid format: "1963-07-19T00:00:00.000+0000" is malformed at "T00:00:00.000+0000"
I've also tried a formatter like so:
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'hh:mm:ss.SSSZ");
But then I get the error:
Cannot parse "1963-07-19T00:00:00.000+0000": Value 0 for clockhourOfHalfday must be in the range [1,12]
And idea how to accomplish what I want?