I have a list of dates from input like the ones below.
I am working on a project and only want to accept the dates that follow the format April 1, 1990 or the January 13, 2003 (taking in any month) format from user input, and any other date format I do not want to accept. I am struggling on how I would use the replace or find function to obtain these goals? Once I receive that format I want to print out the date in this format 7/19/22. If I have the dates in the right format I used the replace function to replace the space, and comma but how would I take that month and replace it with its numerical value? Sorry for all these questions I am just stuck and have been working on this for a while now.
April 1, 1990
November 2 1995
7/19/22
January 13, 2003
userinput = input("Please enter date")
parsed_date = userinput.replace(" ", "/", 2)
new_parsed_date = parsed_date.replace(',',"")
print(new_parsed_date)
March/1/2019
Here is my output when I parse the date. Is there also any easier way to do this task?