title: How do I convert the timestamp of Facebook "Message" object
body: <p>I apologize if this turns out to be a really dumb question. I am reading a <a href="https://developers.facebook.com/docs/messenger-platform/webhook-reference/message" rel="noreferrer">message object</a> through the Facebook messenger API, using Flask in Python. </p>
  
  <p>I first extract the timestamp after reading in the JSON object</p>
  
  <pre><code># read the JSON from Flask "request" object    
  input_json = request.get_json() 
  # extract the timestamp
  ts = input_json["entry"][0]["messaging"][0]["timestamp"]
  </code></pre>
  
  <p>Then I try to convert the result into a human-readable date format using <code>datetime</code> (<a href="https://docs.python.org/2/library/datetime.html" rel="noreferrer">docs</a>), figuring this was a Unix timestamp, but it returns a <em>ValueError: year is out of range</em>. </p>
  
  <pre><code>import datetime
  datetime.datetime.fromtimestamp(int(ts)))
  </code></pre>
  
  <p>Now turns out the specific message has a timestamp <em>1504129573859</em>, which is in the future, when I check e.g. <a href="http://www.unixtimestamp.com/" rel="noreferrer">here</a>.</p>
  
  <p>The same error occurs when I feed it the timestamp given in the documentation (link above), which is <em>1458692752478</em> so I figure it's not an issue with my input parsing. I could not find anything regarding this on here or the FB docs and am grateful for any help!</p>
  
  <ul>
  <li><p>Which time format is this, and how can I convert it to a <code>datetime</code> object?</p></li>
  <li><p>Or is there something wrong with my approach / thinking?</p></li>
  </ul>