title: Python pytz Converting a timestamp (string format) from one timezone to another
body: <p>I have a timestamp with timezone information in string format and I would like to convert this to display the correct date/time using my local timezone. So for eg... I have</p>
  
  <pre><code>timestamp1 = 2011-08-24 13:39:00 +0800
  </code></pre>
  
  <p>and I would like to convert this to say timezone offset +1000 to dsiplay</p>
  
  <pre><code>timestamp2 = 2011-08-24 15:39:00 +1000
  </code></pre>
  
  <p>I have tried using pytz but couldnt find many examples showing how to use the offset information. One other link that I found on stackoverflow which depicts this exact problem is <a href="https://stackoverflow.com/questions/79797/how-do-i-convert-local-time-to-utc-in-python">here</a>. I was hoping there was some better way I could handle this using pytz. Thanks for all suggestions in advance :).</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks Cixate. I just found the solution which is very similar to yours. Found these links helpful - <a href="https://stackoverflow.com/questions/79797/how-do-i-convert-local-time-to-utc-in-python">LINK1</a> and <a href="https://stackoverflow.com/questions/6729902/python-dateutil-parser-fails">LINK2</a></p>
  
  <p>Posting the solution for everyones benefit</p>
  
  <pre><code>from datetime import datetime
  import sys, os
  import pytz
  from dateutil.parser import parse
  
  datestr = "2011-09-09 13:20:00 +0800"
  dt = parse(datestr)
  print dt
  localtime = dt.astimezone (pytz.timezone('Australia/Melbourne'))
  print localtime.strftime ("%Y-%m-%d %H:%M:%S")
  2011-09-09 15:20:00
  </code></pre>