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,313
  • 17
  • 90
  • 128

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
  • 155,977
  • 14
  • 207
  • 269
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
  • 883
  • 1
  • 18
  • 43