Search code examples
pythondatetimenamespaces

type object 'datetime.datetime' has no attribute 'datetime'


I have gotten the following error:

type object 'datetime.datetime' has no attribute 'datetime'

On the following line:

date = datetime.datetime(int(year), int(month), 1)

Does anybody know the reason for the error?

I imported datetime with from datetime import datetime if that helps

Thanks


Solution

  • For python 3.3

    from datetime import datetime, timedelta
    futuredate = datetime.now() + timedelta(days=10)