Using these lines of code:
from datetime import date
date_start = date.now()
I'm getting this error:
AttributeError: type object 'datetime.date' has no attribute 'now'
How can I solve this?
This works:
import datetime
datetime.date.today()
You need to use
import datetime
now = datetime.datetime.now()
Or if you are using django 1.4+ and have timezone enabled you should use
django.utils.timezone.now()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With