Reputation: 33655
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?
Upvotes: 13
Views: 31258
Reputation: 17621
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()
Upvotes: 31