import datetime
d =datetime.datetime.strptime("01/27/2012","%m/%d/%Y").strftime('%m/%d/%Y')
print d
01/27/2012
from datetime import datetime
date_string = "21 June, 2018"
print("date_string =", date_string)
date_object = datetime.strptime(date_string, "%d %B, %Y")
print("date_object =", date_object)
import datetime
d = datetime.datetime.strptime("01/27/2012", "%m/%d/%Y")
print(d)
output ....
2012-01-27 00:00:00