Answers for "'str' object has no attribute 'strftime'"

3

module 'datetime' has no attribute 'strptime'

Use this: from datetime import datetime
instead of Import datetime
Posted by: Guest on August-29-2020
0

'str' object has no attribute 'strftime'

# You should use datetime object, not str.

from datetime import datetime
cr_date = datetime(2013, 10, 31, 18, 23, 29, 227) # don't use str here
cr_date.strftime('%m/%d/%Y')
Posted by: Guest on October-25-2021

Code answers related to "'str' object has no attribute 'strftime'"

Python Answers by Framework

Browse Popular Code Answers by Language