Python: How to convert google location timestaMps in a year-month-day-hour-minute-seconds format?
<p>I am playing around with my google location data (which one can download here <a href="https://takeout.google.com/settings/takeout" rel="nofollow">https://takeout.google.com/settings/takeout</a>). </p>

<p>The location data is a json file, of which one variable is 'timestaMps' (e.g. one observation is "1475146082971"). How do I convert this into a datetime? </p>

<p>Thanks!</p>

<p>Use <a href="https://docs.python.org/2/library/datetime.html#datetime.date.fromtimestamp" rel="nofollow">fromtimestamp</a> method from datetime module. 
To convert your 'timestaMps' to timestamp you need to convert it to int(). Formating of timestamp is done with <a href="https://docs.python.org/2/library/time.html#time.strftime" rel="nofollow">strftime()</a>. </p>

<pre><code>from datetime import datetime
datetime.fromtimestamp(int("1475146082971")).strftime('%Y-%m-%d %H:%M:%S')
</code></pre>

python google-maps datetime timestamp