Skip to content

Instantly share code, notes, and snippets.

@hakanai
Last active January 1, 2017 10:42
Show Gist options
  • Select an option

  • Save hakanai/82de1d63319464a8cf3aaa44ec8108a5 to your computer and use it in GitHub Desktop.

Select an option

Save hakanai/82de1d63319464a8cf3aaa44ec8108a5 to your computer and use it in GitHub Desktop.
The missing code from Jon Skeet's answer to a question on Stack Overflow which shows that once integrated into the DateTimeFormatterBuilder, a custom DateTimePrinter does not give the right result. http://stackoverflow.com/a/17236321/138513
import org.joda.time.LocalDate;
import org.joda.time.ReadablePartial;
import org.joda.time.format.DateTimeFormatterBuilder;
import java.util.Locale;
public class Test {
public static void main(String[] args) {
StringBuffer buffer = new StringBuffer();
ReadablePartial partial = LocalDate.now();
new DateTimeFormatterBuilder()
.appendDayOfMonth(1)
.appendLiteral(' ')
.append(new PolishGenitiveMonthPrinter())
.toPrinter()
.printTo(buffer, partial, Locale.ROOT);
System.out.println(buffer.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment