I\'ve tried the following code :
import datetime
d = datetime.datetime.strptime(\"01/27/2012\", \"%m/%d/%Y\")
print(d)
and the output is :
datetime.strptime(date_string, format)
function returns a datetime
object corresponding to date_string
, parsed according to format
.
When you print datetime
object, it is formatted as a string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS
References: