In article <mailman.5257.1389274514.18130.python-l...@python.org>,
 Ben Finney <ben+pyt...@benfinney.id.au> wrote:

> Kushal Kumaran <kushal.kuma...@gmail.com> writes:
> 
> > Ben Finney <ben+pyt...@benfinney.id.au> writes:
> >
> > > Kushal Kumaran <kushal.kuma...@gmail.com> writes:
> > >
> > >> Roy Smith <r...@panix.com> writes:
> > >> > How, in Python, do you get an aware UTC datetime object?
> > >>
> > >> classmethod datetime.utcnow()
> > >>
> > >>     Return the current UTC date and time, with tzinfo None. […]
> > >
> > > No, that won't do what was asked. The ‘datetime.datetime.utcnow’
> > > function explicitly returns a naive datetime object, not an aware
> > > datetime object.
> >
> > Yes, but the documentation for utcnow explicitly tells you how to get
> > an aware object.
> >
> >   "An aware current UTC datetime can be obtained by calling
> >    datetime.now(timezone.utc)."
> 
> And we come full circle: This is exactly what Roy's original question
> was (IIUC) trying to address. That process is not obvious, and it's not
> simple: it's a series of difficult-to-discover function calls instead of
> just one obvious one.

Yes, exactly.  Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to