I am trying to convert a string datetime to another string time i.e... May 4, 2021 but I am getting the following error
#convert '2021-05-04T05:55:43.013-0500' ->>> May 4, 2021
timing = '2021-05-04T05:55:43.013-0500'
ans = timing.strftime(f'%Y-%m-%d 'f'%H:%M:%S.%f')
Here is the error
AttributeError: 'str' object has no attribute 'strftime'
What am I doing wrong?
datetime? Also you'll want to parse the original string into an object withdatetime.strptime()first, then usedatetime.strftime()to get it to the format you want.