I'd like to convert a string to a Python date-object. I'm using d = datetime.strptime("25-01-1973", "%d-%m-%Y")
, as per the documentation on https://docs.python.org/2/library/datetime.html, and that yields datetime.datetime(1973, 1, 25, 0, 0)
.
When I use d.isoformat()
, I get '1973-01-25T00:00:00'
, but I'd like to get 1973-01-25
(without the time info) as per the docs:
date.isoformat()
Return a string representing the date in ISO 8601 format, ‘YYYY-MM-DD’. For example, date(2002, 12, 4).isoformat() == '2002-12-04'.
It is understood I can use SimpleDateFormat etc., but since the isoformat()
example is explicitly mentioned in the docs, I'm not sure why I'm getting the unwanted time info after the date.
I guess I'm missing a detail somewhere?