I need to find whether a datetime "string format", that is in a list, is valid. I am not trying to convert actual dates into datetime objects rather I'm checking whether a description of a datetime is valid. So for example:
YYYY-MM-DD would be valid while
YYYYY-MM-DDD does not make sense since days do not have 3 values.
So for example if I had a list of strings:
>>> x = ['abc','2020-01-01', 'YYYYMM-DDThh:mm:ss.sss', 'YYYY-MM-DD' ]
>>> check_isostring_valid(x)
[False, False, True, True]
I can't seem to find an answer since every search result seems to be how to convert actual dates to different formats while I only care about whether a representation of a possible date is valid.
The datetime library seems to use a specific format like %Y%m%d that is not the same representation that is normally used to represent date strings.