Last active
January 1, 2017 10:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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