title: How do I know if today is a day due to change civil local time e.g. daylight saving time in standard python and pandas timestamps?
body: <p>According to the rules of British Summer Time / daylight saving time (<a href="https://www.gov.uk/when-do-the-clocks-change" rel="nofollow noreferrer">https://www.gov.uk/when-do-the-clocks-change</a>) the clocks:</p>
  
  <ul>
  <li>go forward 1 hour at 1am on the last Sunday in March,</li>
  <li>go back 1 hour at 2am on the last Sunday in October.</li>
  </ul>
  
  <p>In 2019 this civil local time change happens on March 31st and October 27th, but <strong>the days slightly change every year</strong>. Is there a clean way to know these dates for each input year?</p>
  
  <p>I need to check these "changing time" dates in an automatic way, is there a way to avoid a for loop to check the details of each date to see if it is a "changing time" date?</p>
  
  <p>At the moment I am exploring these dates for 2019 just to try to figure out a reproducible/automatic procedure and I found this:</p>
  
  <pre><code># using datetime from the standard library
  march_utc_30 = datetime.datetime(2019, 3, 30, 0, 0, 0, 0, tzinfo=datetime.timezone.utc)
  march_utc_31 = datetime.datetime(2019, 3, 31, 0, 0, 0, 0, tzinfo=datetime.timezone.utc)
  april_utc_1 = datetime.datetime(2019, 4, 1, 0, 0, 0, 0, tzinfo=datetime.timezone.utc)
  # using pandas timestamps
  pd_march_utc_30 = pd.Timestamp(march_utc_30) #, tz='UTC')
  pd_march_utc_31 = pd.Timestamp(march_utc_31) #, tz='UTC')
  pd_april_utc_1 = pd.Timestamp(april_utc_1) #, tz='UTC')
  # using pandas wrappers
  pd_local_march_utc_30 = pd_march_utc_30.tz_convert('Europe/London')
  pd_local_march_utc_31 = pd_march_utc_31.tz_convert('Europe/London')
  pd_local_april_utc_1 = pd_april_utc_1.tz_convert('Europe/London')
  # then printing all these dates
  print("march_utc_30 {} pd_march_utc_30 {} pd_local_march_utc_30 {}".format(march_utc_30, pd_march_utc_30, pd_local_march_utc_30))
  print("march_utc_31 {} pd_march_utc_31 {} pd_local_march_utc_31 {}".format(march_utc_31, pd_march_utc_31, pd_local_march_utc_31))
  print("april_utc_1  {} pd_april_utc_1  {} pd_local_april_utc_1  {}".format(april_utc_1, pd_april_utc_1, pd_local_april_utc_1))
  </code></pre>
  
  <p>The output of those <code>print</code> statements is:</p>
  
  <pre><code>march_utc_30 2019-03-30 00:00:00+00:00 pd_march_utc_30 2019-03-30 00:00:00+00:00 pd_local_march_utc_30 2019-03-30 00:00:00+00:00
  march_utc_31 2019-03-31 00:00:00+00:00 pd_march_utc_31 2019-03-31 00:00:00+00:00 pd_local_march_utc_31 2019-03-31 00:00:00+00:00
  april_utc_1  2019-04-01 00:00:00+00:00 pd_april_utc_1  2019-04-01 00:00:00+00:00 pd_local_april_utc_1  2019-04-01 01:00:00+01:00
  </code></pre>
  
  <p>I could use a <code>for</code> loop to <strong>find out if the current date is the last Sunday of the month</strong>, or compare the "hour delta" between the current date and the date of the day after to see if there is a +1, but I am wondering if there is a cleaner way to do this?</p>
  
  <p>Is there something attached to the year e.g. knowing the input year is <code>2019</code> then we know for sure the "change date" in March will be day 31st?</p>