title: How can i convert a python local datetime object to utc
body: <p>I have <code>due_by</code> as a local <code>datetime</code> object the following solutions isn't working for me!</p>
  <pre><code>due_by = float(due_by.strftime(&quot;%s&quot;))
  due_by = datetime.utcfromtimestamp(due_by)
  </code></pre>
  <p>Thanks in advance!</p>