You can use the local module in conjunction with time.strptime() to ensure that the date / time is in the correct order (month, day, year, etc.). Or you can do a simple regex ...
pattern = re.compile(r'\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2} (AM|PM)') . .. I am not a regex pro lol, perhaps the best sample.
You can also use the datetime module and create a new datetime object with the locale constant and convert the numbers to the appropriate type (day, month, year).
Good luck
source share