Get original pattern String given a JDK 8 DateTimeFormatter?

pathikrit picture pathikrit · Mar 9, 2015 · Viewed 10k times · Source

Related to my question here - how do I get the original pattern String given a DateTimeFormatter?

Answer

assylias picture assylias · Mar 9, 2015

It's been asked on the mailing list and the answer is that it is not possible because the original pattern is not retained.

The same thread suggests using a DateTimeFormatterBuilder which does have the information.