The output of datetime.datetime.now()
outputs in my native timezone of UTC-8. I'd like to convert that to an appropriate timestamp with a tzinfo of UTC.
from datetime import datetime, tzinfo
x = datetime.now()
x = x.replace(tzinfo=UTC)
^ outputs NameError: name 'UTC' is not defined
x.replace(tzinfo=<UTC>)
outputs SyntaxError: invalid syntax
x.replace(tzinfo='UTC')
outputs TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'str'
What is the correct syntax to use to accomplish my example?