title: python: need help to implement strptime() the right way
body: <p>I am trying to find the difference in days between the current date and the date that I extract from the database (postgresql)</p>
  
  <p>This is my code:</p>
  
  <pre><code>    cur.execute('select id, city_id, event_id, duration, DATE(startdate) from main_cityevent where DATE(startdate) &lt;= DATE(NOW())')
      rows = cur.fetchall()
      for city_event in rows:
              startdate = str(city_event[4])
              sd = datetime.strptime(startdate, "%Y-%m-%d")
              diff = datetime.datetime.now() - sd
  </code></pre>
  
  <p>the last command (diff = datetime.datetime.now() - sd) gives me an AttributeError.</p>
  
  <p>What am I doing wrong?</p>