Object Has No Attribute 'Strftime' Issue

817 Views Asked by At

This is my code:

now = datetime.now 

print ("Today's date is, ")
print (now.strftime("%A, %D, %B, %Y"))

This is the issue I am getting:

AttributeError: 'builtin_function_or_method' object has no attribute 'strftime'
repl process died unexpectedly: exit status 1

I tried changing it to datetime instead of strftime but it still doesn't work. I do have the import datetime from datetime.

1

There are 1 best solutions below

0
Zombro On

as mentioned in the first comment, now is a function.

import datetime
now = datetime.datetime.now()
print ("Today's date is, ") 
print (now.strftime("%A, %D, %B, %Y"))