datetime.now() does not seem to provide timezone information. I want the current time in UTC. What should I do?
>>> from datetime import datetime >>> y = datetime.now() >>> y datetime.datetime(2014, 3, 11, 11, 18, 33, 598489)
At first I thought datetime.utcnow() an obvious solution, but then I found that it does not have time zone information (WTF?).
>>> from datetime import datetime >>> y = datetime.utcnow() >>> y datetime.datetime(2014, 3, 11, 16, 19, 40, 238810)
source share