the Gravity of Python 2

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Jan 9 03:53:28 EST 2014


On 09/01/2014 06:06, Kushal Kumaran wrote:
>
> 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.
>

Blimey, you learn something new everyday, thanks.  And it works :)

In [7]: datetime.datetime.now(datetime.timezone.utc)
Out[7]: datetime.datetime(2014, 1, 9, 8, 51, 13, 945312, 
tzinfo=datetime.timezone.utc)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list