How do I get the date format for the given date input in python? Note: The input is given by the user which is not predefined format .They may give any kind of input format .. The below example is working for dd-mm-yyyy format .But this is not in my case.Date format is not predefined. datetime.datetime.strptime('24052010', "%d%m%Y").date()
Expected :
Input 1: 21–02–2019 ,Output: DD-MM-YYYY . Input 2: 02/21/2019 ,Output : MM/DD/YYYY