DateTimeFormatter to serialize LocalDate as 1st/2nd/3rd of a month

I'd like to display LocalDate as:

first day: 1st;

second day: 2nd;

third day: 3rd;

all rest days: Nth.

e.g. 1980-10-1 as 1st Oct 1980

I'm able to serialize it excluding the first 3 days using DateTimeFormatter.ofPattern("dth MMM yyyy").

Since the first 3 days have a different pattern than the rest days, how to construct the formatter to serialize also the first 3 days?...

Read More »

By: StackOverFlow - Tuesday, 20 November

Related Posts