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/2690e18e/attachment.html below:

<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 3:07 PM, 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"><span class="">> No, it does not. Please read the documentation: "self must be aware (self.tzinfo must not be None, and self.utcoffset() must not return None)."<br>
<br>
</span>Whoops, you're right. But that's even worse-- it doesn't give you a way to convert a naive datetime at all. Currently the only way from "2013-11-03 01:30:00" to "2013-11-03 01:30:00-0500 America/Chicago" is still datetime.replace().</blockquote></div><br>Well, you are right, but at least we do have a localtime utility hidden in the email package:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">>>> from datetime import *</div><div class="gmail_extra">>>> from email.utils import localtime</div><div class="gmail_extra">>>> print(localtime(datetime.now()))</div><div class="gmail_extra">2015-04-09 15:19:12.840000-04:00</div><div class="gmail_extra"><br></div><div class="gmail_extra">You can read <<a href="http://bugs.python.org/issue9527">http://bugs.python.org/issue9527</a>> for the reasons it did not make into datetime.</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