[resolved] How to parse date with single-digit month or year
Trying to parse dates with a tFileInputDelimited and a date pattern of "dd-MM-yyyy HH:mm:ss", I am getting the error "Unparseable date: 8/13/1949 0:00:00". I assumed this was because the month is only a single digit instead of the expected two.
So digging into the source code of ParserUtils.java and FastDateParser.java, it seems that my date pattern must be from java.text.SimpleDateFormat, which would suggest that it needs to be "d-M-yyyy H:mm:ss"... but that doesn't work either.
Is there a better date pattern to use that will accept single or double-digit months/days/hours? Or do I need to find another way to parse these?
Doh! It was simple thoughtlessness on my part: I had swapped the "month" and "day" values in the pattern string, so of course it's going to fail when the "month" is over 12! Even sillier, I had dashes instead of slashes, so of course it didn't match.
Maybe I should go work on something else for a while...
Doh! It was simple thoughtlessness on my part: I had swapped the "month" and "day" values in the pattern string, so of course it's going to fail when the "month" is over 12! Even sillier, I had dashes instead of slashes, so of course it didn't match.
Maybe I should go work on something else for a while...