I want to display a list of dates that may or may not have milliseconds on them. If a certain entry has milliseconds, then it should be displayed like yyyy MM dd HH:mm:ss.SSS
. If it doesn't have the millis, I need it displayed as yyyy MM dd HH:mm:ss
.
I suppose the general question is: Is there a way to describe an optional format string parameter?
(I'd like to avoid refactoring all of the places that I use formatters since this is a large code base.)