AttributeError: type object 'datetime.date' has no attribute 'now'

python

Solution

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()

Problem

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?

Original source