<story><title>datetime.utcnow() is now deprecated</title><url>https://blog.miguelgrinberg.com/post/it-s-time-for-a-change-datetime-utcnow-is-now-deprecated</url></story><parent_chain><item><author>vegabook</author><text>I suspect a lot of financial data code is going to break. I&amp;#x27;ve worked on a number of codebases where the explicit instructions were &amp;quot;everything is UTC, all the time&amp;quot;, and enforced at the entry edges of the code. Bringing  in timezones was a definite NO for reasons of the unholy mess this would inevitably create:&lt;p&gt;* India has half-hour timezones&lt;p&gt;* Countries change their DST rules all the time.&lt;p&gt;* Conversion between timezones is an utter mess.&lt;p&gt;As Wes McKinney once said about python datetime: &amp;quot;Welcome to Hell&amp;quot;[0]&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;a&amp;#x2F;13753918&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;a&amp;#x2F;13753918&lt;/a&gt;</text></item></parent_chain><comment><author>albert_e</author><text>&amp;gt; India has half-hour timezones&lt;p&gt;Not plural though;&lt;p&gt;The whole of India -- even though it is pretty vast in area -- has a single time-zone country-wide. I am very thankful for this. We already have a lot of other challenges -- including dozens of different languages -- that a single time zone is a relief.&lt;p&gt;But yes -- the +5:30 offset usually makes for a less-than-ideal factor to plan meetings or follow non local event schedules.&lt;p&gt;Did I mention we also hate the Summertime &amp;#x2F; Daylight Saving time adjustments we have to accommodate twice a year when working with western teams -- more adjustment even after most people have already sacrificed on a sane 9-5 schedule to ensure they overlap with EU&amp;#x2F;US teams for daily work meetings. We cant imagine why US that has multiple time-zones already in a single country, and EU whose countries are often smaller than states in India ... need so much adjustment. Why can&amp;#x27;t they, for instance, simply declare that school&amp;#x2F;offices open at 10am instead of 9am for six designated months every year instead of imposing this adjustment on the entire world.</text></comment>
<story><title>datetime.utcnow() is now deprecated</title><url>https://blog.miguelgrinberg.com/post/it-s-time-for-a-change-datetime-utcnow-is-now-deprecated</url></story><parent_chain><item><author>vegabook</author><text>I suspect a lot of financial data code is going to break. I&amp;#x27;ve worked on a number of codebases where the explicit instructions were &amp;quot;everything is UTC, all the time&amp;quot;, and enforced at the entry edges of the code. Bringing  in timezones was a definite NO for reasons of the unholy mess this would inevitably create:&lt;p&gt;* India has half-hour timezones&lt;p&gt;* Countries change their DST rules all the time.&lt;p&gt;* Conversion between timezones is an utter mess.&lt;p&gt;As Wes McKinney once said about python datetime: &amp;quot;Welcome to Hell&amp;quot;[0]&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;a&amp;#x2F;13753918&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;a&amp;#x2F;13753918&lt;/a&gt;</text></item></parent_chain><comment><author>Hamuko</author><text>I&amp;#x27;d say that wouldn&amp;#x27;t enforcement be rather simple going forwards since you could just enforce that dt.tzinfo == datetime.timezone.utc, but as far as I know, timezone information checking in Python can be a bit of a pain.&lt;p&gt;&lt;pre&gt;&lt;code&gt;  &amp;gt;&amp;gt;&amp;gt; utc1 = datetime.timezone.utc
  &amp;gt;&amp;gt;&amp;gt; utc2 = zoneinfo.ZoneInfo(&amp;quot;UTC&amp;quot;)
  &amp;gt;&amp;gt;&amp;gt; utc1 == utc2
  False
  &amp;gt;&amp;gt;&amp;gt; dt1 = datetime.datetime.now(utc1)
  &amp;gt;&amp;gt;&amp;gt; dt2 = datetime.datetime.now(utc2)
  &amp;gt;&amp;gt;&amp;gt; dt1.tzinfo == dt2.tzinfo
  False&lt;/code&gt;&lt;/pre&gt;</text></comment>