title: Convert nanoseconds to timestamp in Python
body: <p>I know it is possible to convert nanoseconds in java to a timestamp like this:</p>
  
  <pre><code>import java.util.Date;
   public class DateDemo {
  
    public static void main(String args[]) {
    // Instantiate a Date object
  
      long i = 1462352019029395103L;
    // display time and date using toString()
     Date date = new Date(i / 1000000);
  
    System.out.println(date.toString());
    }
   }
  </code></pre>
  
  <p>This make: Wed May 04 08:53:39 UTC 2016</p>
  
  <p>While in Python the output is:</p>
  
  <pre><code>&gt;&gt;&gt; from datetime import datetime
  &gt;&gt;&gt; dt = datetime.fromtimestamp(1462352019029395103 // 1000000000)
  &gt;&gt;&gt; s = dt.strftime('%Y-%m-%d %H:%M:%S')
  &gt;&gt;&gt; s
  '2016-05-04 10:53:39'
  </code></pre>
  
  <p>The difference is 2 hours in python. I don't know exactly why. I read some earlier posts that Python couldn't convert nanoseconds. Is there any way I get the accurate timestamp in python?</p>