How to convert Joda LocalDate to String in Java?

Surya Rao Rayarao picture Surya Rao Rayarao · Sep 14, 2010 · Viewed 72.2k times · Source

I got the answer: It's very simple.

DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd/yyyy");
String formattedDate = jodeLocalDateObj.toString( fmt );

Answer

stephen.hanson picture stephen.hanson · Mar 4, 2013

LocalDate's toString can take a format string directly, so you can skip creating the DateTimeFormatter:

String formattedDate = myLocalDate.toString("MM/dd/yyyy");

https://www.joda.org/joda-time/apidocs/org/joda/time/LocalDate.html#toString-java.lang.String-