title: How to convert string with UTC offset
body: <p>I have date as </p>
  
  <pre><code>In [1]: a = "Sun 10 May 2015 13:34:36 -0700"
  </code></pre>
  
  <p>When I try to convert it using <a href="https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior" rel="nofollow"><code>strptime</code></a>, its giving error.</p>
  
  <pre><code>In [3]: datetime.strptime(a, "%a %d %b %Y %H:%M:%S %Z"
     ...: )
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-3-973ef1c6daca&gt; in &lt;module&gt;()
  ----&gt; 1 datetime.strptime(a, "%a %d %b %Y %H:%M:%S %Z"
        2 )
  /usr/lib/python2.7/_strptime.pyc in _strptime(data_string, format)
      323     if not found:
      324         raise ValueError("time data %r does not match format %r" %
  --&gt; 325                          (data_string, format))
      326     if len(data_string) != found.end():
      327         raise ValueError("unconverted data remains: %s" %
  ValueError: time data 'Sun 10 May 2015 13:34:36 -0700' does not match format '%a %d %b %Y %H:%M:%S %Z'
  In [6]: datetime.strptime(a, "%a %d %b %Y %H:%M:%S %z")
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-6-e4870e34edda&gt; in &lt;module&gt;()
  ----&gt; 1 datetime.strptime(a, "%a %d %b %Y %H:%M:%S %z")
  /usr/lib/python2.7/_strptime.pyc in _strptime(data_string, format)
      315                 del err
      316                 raise ValueError("'%s' is a bad directive in format '%s'" %
  --&gt; 317                                     (bad_directive, format))
      318             # IndexError only occurs when the format string is "%"
      319             except IndexError:
  ValueError: 'z' is a bad directive in format '%a %d %b %Y %H:%M:%S %z'
  </code></pre>
  
  <p>As per doc, correct format is <code>%z</code>, but I might missing some part.</p>