A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20150409/0a1d2779/attachment.html below:

<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 11:59 AM, Isaac Schwabacher <span dir="ltr"><<a href="mailto:ischwabacher@wisc.edu" target="_blank">ischwabacher@wisc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I just looked through the datetime documentation, and it looks like the currently blessed way of creating an aware datetime from a naive local datetime and a tzinfo is datetime.replace, which is too low level to handle the job.</blockquote></div><br>Not quite.Ă‚  That's how you would create a UTC datetime, but from there you can get to your local timezone by callingĂ‚ astimezone() with no arguments:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">>>> print(datetime.now(timezone.utc).astimezone())</div><div class="gmail_extra">2015-04-09 12:16:58.576272-04:00</div></div></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4