DateTimeFormatter serializes LocalDate to the 1st/2/3rd of the month… here is a solution to the problem.
DateTimeFormatter serializes LocalDate to the 1st/2/3rd of the month
I want to display LocalDate
as:
first day: 1st;
second day: 2nd;
third day: 3rd;
all rest days: Nth.
For example, 1980-10-1 as October 1, 1980
I can serialize it using DateTimeFormatter.ofPattern("dth MMM yyyy"),
but not the first 3 days.
Since the pattern for the first 3 days is different from the rest of the days, how do I build a formatter to serialize the first 3 days?