0

How can I format a LocalDate instance to the tune of 18th Aug, 2013 using Joda Time Date formatter?

LocalDate localDate = new LocalDate();
string = localDate.toString(dateformat); //what to put in here?
Binoy Babu
  • 16,699
  • 17
  • 91
  • 134

2 Answers2

0

The closest you will get is

String dateString = localDate.toString("dd MMM yyyy");

i.e. the date affix ("th" in this case) is not supported

Reimeus
  • 158,255
  • 15
  • 216
  • 276
0
LocalDate localDate = new LocalDate();
DateTimeFormatter fmt = DateTimeFormat.forPattern("ddd MMMM, yyyy");
string = localDate.toString();

More information about Joda Time formatting you can find at http://www.joda.org/joda-time/key_format.html. there's also explained how to use Builder to make custom date patterns.

Good luck

Lukas Novicky
  • 921
  • 1
  • 19
  • 44