I don't quite understand what you mean by "guessing the date format" what you mean is changing the default way Python works with dates? Because that is difficult if not impossible. Secondly if you want to format that text why not use datetime.
from datetime import datetime
datetime.strptime("20221112", '%Y%m%d') # datetime.datetime(2022, 12, 11, 0, 0)
# Or you can also try
datetime.strptime("20221211", '%Y%d%m') # datetime.datetime(2022, 11, 12, 0, 0)
if you are bothered by using datetime.strptime you can use it in a function
def format_time(time_str, format='%Y%m%d'):
return datetime.strptime(time_str, format)
print(format_time("20231011")) # 2023-10-11 00:00:00
As a resource I leave you this to help you with formats Python Strptime
Of course, if you don't know how the sample data comes, you will have to interpret it by default because it is impossible to know how to interpret it.
I would personally use YYYYMMDD