title: Converting Epoch time into the datetime
body: <p>I am getting a response from the rest is an Epoch time format like</p>
  
  <pre><code>start_time = 1234566
  end_time = 1234578
  </code></pre>
  
  <p>I want to convert that epoch seconds in MySQL format time so that I could store the differences in my MySQL database.</p>
  
  <p>I tried:</p>
  
  <pre><code>&gt;&gt;&gt; import time
  &gt;&gt;&gt; time.gmtime(123456)
  time.struct_time(tm_year=1970, tm_mon=1, tm_mday=2, tm_hour=10, tm_min=17, tm_sec=36, tm_wday=4, tm_yday=2, tm_isdst=0)
  </code></pre>
  
  <p>The above result is not what I am expecting. I want it be like </p>
  
  <pre><code>2012-09-12 21:00:00
  </code></pre>
  
  <p>Please suggest how can I achieve this?</p>
  
  <p>Also,
  Why I am getting <code>TypeError: a float is required</code> for</p>
  
  <pre class="lang-none prettyprint-override"><code>&gt;&gt;&gt; getbbb_class.end_time = 1347516459425
  &gt;&gt;&gt; mend = time.gmtime(getbbb_class.end_time).tm_hour
  Traceback (most recent call last):
    ...
  TypeError: a float is required
  </code></pre>