Apr-20-2017, 03:44 AM
Hi,
I have the following
Wonder if someone could please advise.
Thank you!
I have the following
myList[0][0]
Output:'02/28/2017 21:01:00'
type(myList[0][0])
Output:<class 'str'>
str_date = myList[0][0] from datetime import datetime date_date = datetime.strftime(str_date, "%m/%d/%Y %H:%M:%S")I tried to convert the string object to a datetime object but I got the following error message.
Error:TypeError: descriptor 'strftime' requires a 'datetime.date' object but received a 'str'
Shouldn't with datetime.strftime method, I would be able to convert the string object to datetime object?Wonder if someone could please advise.
Thank you!