I am reading some dates values from XML documents and generating MySQL insert statements. Some date values refer to month and year and are in the following format: "YYYYMo00"
For example, May 2010, would be recorded as "20100500". Although the date is expressed as "00", MySql accepts the inserts statement into the date value without any problems.
Some datevalues are incorrect (e.g. "20103400"). In this example the months cannot be 34. MySql server does not process this insert and I need to catch these improper dates prior to sending them to MySql.
How to validate strings representing dates prior to generating the MySQL Insert Statement?
I have tried using dateutil.parser.parse() function to validate the strings. This did not work because the function thought "20103400" were not valid, while MySQL Server can clearly accept these values.
I need a solution that validates date strings, while accepting the "20103400" format.