title: python datetime.astimezone behavior incorrect?
body: <p>Here is the code which first parses time from string in IST and then converts that to UTC. So when it 4:00 pm in India the time in GMT / UTC is 10:30 am. While the following code prints it as 9:30 pm. So instead of subtracting the offset it is adding the offset. From the python documentation <a href="https://docs.python.org/2/library/datetime.html#datetime.datetime.astimezone" rel="nofollow">https://docs.python.org/2/library/datetime.html#datetime.datetime.astimezone</a> the sample implementation of astimezone, it does appear that it would add the offset if it is negative but it seems contrary to what it should do. The documentation says that it adjusts the time such that UTC time remains same but in passed timezone's local time which is contrary to the sample implementation.</p>
  
  <pre><code>from dateutil.parser import parse
  from pytz import timezone
  
  d = parse('Tue Sep 01 2015 16:00:00 GMT+0530')
  
  # Prints datetime.datetime(2015, 9, 1, 16, 0, tzinfo=tzoffset(None, -19800))
  print d
  
  utc = timezone('UTC')
  
  # Prints datetime.datetime(2015, 9, 1, 21, 30, tzinfo=&lt;UTC&gt;)
  print d.astimezone(utc)
  </code></pre>
  
  <p>I am not sure what is wrong. Is it the implementation of the astimezone or the documentation or the offset itself has its sign reversed?</p>