I'm retrofitting old some SimpleDateFormat
code to use the new Java 8 DateTimeFormatter
. SimpleDateFormat
, and thus the old code, accepts strings with stuff in them after the date like "20130311nonsense". The DateTimeFormat
I created throws a DateTimeParseException
for these strings, which is probably the right thing to do, but I'd like to maintain compatibility. Can I modify my DateTimeFormat
to accept these strings?
I'm currently creating it like this:
DateTimeFormatter.ofPattern("yyyyMMdd")