Kushal Kumaran <kushal.kuma...@gmail.com> writes: > Roy Smith <r...@panix.com> writes: > > How, in Python, do you get an aware UTC datetime object? > > My local copy of the python 3.2.3 docs says: > > classmethod datetime.utcnow() > > Return the current UTC date and time, with tzinfo None. This is > like now(), but returns the current UTC date and time, as a naive > datetime object. An aware current UTC datetime can be obtained by > calling datetime.now(timezone.utc). See also now(). > > Hope this helps.
No, that won't do what was asked. The ‘datetime.datetime.utcnow’ function explicitly returns a naive datetime object, not an aware datetime object. -- \ “We must respect the other fellow's religion, but only in the | `\ sense and to the extent that we respect his theory that his | _o__) wife is beautiful and his children smart.” —Henry L. Mencken | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list