pythondatetimetimezonenameerror

How to use tzutc()


What am I missing, how do I get this function to work?

import dateutil.parser
import datetime

my_date = datetime.datetime(2000, 1, 1, 0, 0, 0, 000000, tzinfo=tzutc())

print(my_date)

Gives me the error:

NameError: name 'tzutc' is not defined

Solution

  • You did not import it:

    from dateutil.tz import tzutc