Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[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?
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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...

View solution in original post

1 Reply
Anonymous
Not applicable
Author

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...