Trying to find an out of the box solution to format the java LocalDateTime in chronological pattern available in Java 8 APIs.
class MyDateFormatter {
public static void main(String[] args) {
ZonedDateTime cetTime= LocalDateTime.parse(dateInput, DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"))
.atZone(ZoneId.of("CET"));
System.out.println(cetTime); // Prints 2008-11-01T12:24:01+01:00[CET]
String estTime = cetTime.withZoneSameInstant(ZoneId.of("US/Eastern")).format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL));
System.out.println(estTime) // Prints Saturday, November 1, 2008 7:24:01 AM EDT
}
}
The estTime seems not to fit my expected pattern. I am looking for an output with ordinal on the date.
Actual : Saturday, November 1, 2008 7:24:01 AM EDT
Expected : Saturday, November 1st, 2008 7:24:01 AM
Could someone please help if this possible with java 8 APIs. My question is specific to Java8 API support for this