I have a situation where I need to create a Datetime object from a string. The issue comes when I don't have consistency in the pattern of the string representing the date. These are examples of my data:
07/17/2012
2013/03/11
17/05/2015
17/17/2015
As you can see, the last one is invalid no matter what, because there is no 17 month, but the first 3 are valid depending on the month position(and of course, the year)
My question: is there any way(pretty sure through regex) to make a function with the date string as parameter that return the datetime object. If the string is not valid, return: 1/1/1970...
'/'. If it is 4 you know its the year.