title: Removing milliseconds from datetime object in Python
body: <p>I am trying to remove the milliseconds(28109) from this string <code>2017-09-12 22:33:55.28109</code> in Python. </p>
  
  <p>code:</p>
  
  <pre><code>import datetime as dt
  from datetime import date,datetime
  
  created_date = datetime.fromtimestamp(ctime)
  d=datetime.strptime(created_date, "%Y-%m-%d %H:%M:%S.%fZ")
  created_date = datetime.strftime(d, "%m/%d/%Y %I:%M:%S %p")
  print(created_date)
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>`d=datetime.strptime(created_date, "%Y-%m-%d %H:%M:%S.%fZ")`
  </code></pre>
  
  <p><code>TypeError: must be str, not datetime.datetime</code></p>