title: python function to return javascript date.getTime()
body: <p>I'm attempting to create a simple python function which will return the same value as javascript <code>new Date().getTime()</code> method.
  As written <a href="http://www.w3schools.com/js/js_dates.asp" rel="noreferrer">here</a>, javascript getTime() method returns number of milliseconds from 1/1/1970</p>
  
  <p>So I simply wrote this python function:  </p>
  
  <pre><code>def jsGetTime(dtime):
      diff = datetime.datetime(1970,1,1)
      return (dtime-diff).total_seconds()*1000
  </code></pre>
  
  <p>while the parameter dtime is a python datetime object.</p>
  
  <p>yet I get wrong result. what is the problem with my calculation?</p>