Given a string that contains a datetime format, I want to tell the user whether it can be sorted as string or not.
For instance:
'%Y-%m-%d %H:%M:%S'is sortable'%m-%d %H:%M'is sortable'%d-%m %H:%M'is not (28-05 will appear before 29-04 if we sort it in string)
My approach would be to parse the string and check if we follow the following order:
- Y before m before d
- H before M before S
This approach is tedious, is there an easy effective way to accomplish this ?