title: How to convert a datetime object between CEST and UTC timezones
body: <p>I don't want to use the <code>pytz</code> library as the project I am working on requires paperwork to introduce dependencies. If I can achieve this without a third party library I'll be happier.</p>
  
  <p>I'm having trouble converting a date between CET and UTC when the date is in daylight savings. It's an hour different to what I expect:</p>
  
  <pre><code>&gt;&gt;&gt; print from_cet_to_utc(year=2017, month=7, day=24, hour=10, minute=30)
  2017-07-24T09:30Z
  
  2017-07-24T08:30Z  # expected
  </code></pre>
  
  <p>CET is an hour ahead of UTC and in summertime is 2 hours ahead. So I would expect 10:30 in central Europe in midsummer to actually to 8:30 UTC.</p>
  
  <p>The function is:</p>
  
  <pre><code>from datetime import datetime, tzinfo, timedelta
  
  def from_cet_to_utc(year, month, day, hour, minute):
      cet = datetime(year, month, day, hour, minute, tzinfo=CET())
      utc = cet.astimezone(tz=UTC())
      return '{:%Y-%m-%d:T%H:%MZ}'.format(utc)
  </code></pre>
  
  <p>I use two timezone info objects:</p>
  
  <pre><code>class CET(tzinfo):
      def utcoffset(self, dt):
          return timedelta(hours=1)
  
      def dst(self, dt):
          return timedelta(hours=2)
  
  class UTC(tzinfo):
      def utcoffset(self, dt):
          return timedelta(0)
  
      def dst(self, dt):
          return timedelta(0)
  </code></pre>