0

I have a code as below to convert a string to date:

DateTimeFormatter formatter = org.joda.time.format.DateTimeFormat.forPattern("MM/dd/yyyy");
LocalDate checkInDate = LocalDate.parse("08/25/2015");

But when i run the code there is an error:

java.lang.IllegalArgumentException: Invalid format: "08/25/2015" is malformed at "/25/2015"

Anyone can help me resolve this problem.

durron597
  • 31,968
  • 17
  • 99
  • 158
Luasg
  • 93
  • 1
  • 11

1 Answers1

1

Try using the formatter:

LocalDate checkInDate = formatter.parseLocalDate("08/25/2015");

Dennis Hunziker
  • 1,293
  • 10
  • 19