title: Converting numpy datetime64 to long integer and back
body: <p>How to convert NumPy datetime64 to a long ineteger and back?</p>
  
  <pre><code>import numpy as np
  import datetime
  
  np.datetime64(datetime.datetime.now()).astype(long)
  </code></pre>
  
  <p>Gives a value of 1511975032478959</p>
  
  <pre><code>np.datetime64(np.datetime64(datetime.datetime.now()).astype(long))
  </code></pre>
  
  <p>Gives an error: </p>
  
  <pre><code>ValueError: Converting an integer to a NumPy datetime requires a specified unit
  </code></pre>