<div dir="ltr"><div class="" style="font-size:medium"></div><div class="" style="font-size:medium"></div><div class="" style="font-size:medium"></div><div class="" style="font-size:medium"></div><div id=":d4" tabindex="-1" style="font-size:medium"></div><div id=":dg" class="" style="font-size:12.8000001907349px"><div id=":dh" class="" style="overflow:hidden"><div dir="ltr"><span class="im"><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 style="font-size:12.8000001907349px">This surprised me today:</span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><div>>>> import datetime</div><div>>>> datetime.datetime.today(), datetime.datetime.now()</div><div>(datetime.datetime(2015, 9, 16, 8, 44, 7, 723560), datetime.datetime(2015, 9, 16, 8, 44, 7, 723577))</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">I naively expected today() to always return a datetime.date object. Oh well, bug in my code has been squashed.</div></blockquote><div><br></div></span><div>Just in the case you didn't figure it out:</div><div><br></div><div> >>> datetime.datetime.today()</div><div>datetime.datetime(2015, 9, 16, 14, 50, 47, 700828)</div><div>>>> datetime.date.today()</div><div>datetime.date(2015, 9, 16)</div><div><br></div><div>You were accessing the today method of the datetime property which inevitably returns a datetime object. Getting today from the date object will return an actual date.</div><div><br></div><div>Now and today are very, very, similar - but now may be more accurate and gives flexibility with timezones as per <a href="https://docs.python.org/3/library/datetime.html#datetime.datetime.now" target="_blank">https://docs.python.org/3/library/datetime.html#datetime.datetime.now</a></div><div><br></div><div>- Nick</div></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><br></div></div></div></div></div>