title: python converting string in localtime to UTC epoch timestamp
body: <p>I have strings in YMD hms format that had the timezone stripped. But I know they are in Eastern time with daylight savings time. </p>
  
  <p>I am trying to convert them into epoch timestamps for UTC time. </p>
  
  <p>I wrote the following function:</p>
  
  <pre><code>def ymdhms_timezone_dst_to_epoch(input_str,  tz="US/Eastern"):
      print(input_str)
      dt = datetime.datetime.fromtimestamp(time.mktime(time.strptime(input_str,'%Y-%m-%d %H:%M:%S')))
      local_dt = pytz.timezone(tz).localize(dt)
      print(local_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'))
      utc_dt = local_dt.astimezone(pytz.utc)
      print(utc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'))    
      e = int(utc_dt.strftime("%s"))
      print(e)
      return e
  
  Given string `2015-04-20 21:12:07` this prints:
  
      2015-04-20 21:12:07
      2015-04-20 21:12:07 EDT-0400 #&lt;- so far so good?
      2015-04-21 01:12:07 UTC+0000 #&lt;- so far so good?
      1429596727
  </code></pre>
  
  <p>which looks ok up to the epoch timestamp. But <a href="http://www.epochconverter.com/epoch/timezones.php?epoch=1429596727" rel="nofollow">http://www.epochconverter.com/epoch/timezones.php?epoch=1429596727</a> says it should mao to 
  Greenwich Mean Time Apr 21 2015 06:12:07 UTC. </p>
  
  <p>What is wrong?</p>