title: How to format +xxxx for strptime()
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3305413/python-strptime-and-timezones">Python strptime() and timezones?</a>  </p>
  </blockquote>
  
  
  
  <p>I have string like [22/Aug/2012:13:08:27 +0400] and how I can convert it in time tuple with strptime function?</p>
  
  <pre><code>time.strptime(t, '[%d/%b/%Y:%H:%M:%S +0400]')
  </code></pre>
  
  <p>works but obviously I need format time offset too.</p>
  
  <p>And when I try format +0400 with %Z, I have:</p>
  
  <pre><code>ValueError: time data '[22/Aug/2012:13:08:27 +0400]' does not match format '[%d/%b/%Y:%H:%M:%S %Z]'
  </code></pre>
  
  <p>and when I try %z</p>
  
  <pre><code>ValueError: 'z' is a bad directive in format '[%d/%b/%Y:%H:%M:%S %z]'
  </code></pre>