Convert Mysql timestamp to Python's datetime
<p>I have a table in MySQL that has a column with <code>TIMESTAMP</code> datatype.
This is what the value on that column looks like on MySQL. </p>

<p><a href="https://i.stack.imgur.com/LsfEH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LsfEH.png" alt="enter image description here"></a></p>

<p>When I try to fetch that <code>InstallTs</code> column using Python, this is the result I get. </p>

<blockquote>
  <p>Tue Apr 26 03:10:02 SGT 2016</p>
</blockquote>

<p>This is the code I have for converting it to the same format as the one from MySQL 
print mysql_time</p>

<pre><code>mysql_time = 'Tue Apr 26 03:10:02 SGT 2016'
print datetime.datetime.strptime(str(mysql_time), '%a %b %m %H:%M:%S %Z %Y').strftime("%Y-%m-%d %H:%M:%S")
</code></pre>

<p>This is the result I get: </p>

<pre><code>2018-02-06 03:10:02
</code></pre>

<p>Can anyone shed some light as to why it is different from the one I fetch from MySQL?</p>