Why does this python date/time conversion seem wrong?
<pre><code>&gt;&gt;&gt; import time
&gt;&gt;&gt; time.strptime("01-31-2009", "%m-%d-%Y")
(2009, 1, 31, 0, 0, 0, 5, 31, -1)
&gt;&gt;&gt; time.mktime((2009, 1, 31, 0, 0, 0, 5, 31, -1))
1233378000.0
&gt;&gt;&gt; 60*60*24 # seconds in a day
86400
&gt;&gt;&gt; 1233378000.0 / 86400
14275.208333333334
</code></pre>

<p>time.mktime should return the number of seconds since the epoch. Since I'm giving it a time at midnight and the epoch is at midnight, shouldn't the result be evenly divisible by the number of seconds in a day?</p>

<p>Short answer: Because of timezones.</p>

<p>The Epoch is in UTC.</p>

<p>For example, I'm on IST (Irish Stsandard Time) or GMT+1. time.mktime() is relative to my timezone, so on my system this refers to</p>

<pre><code>&gt;&gt;&gt; time.mktime((2009, 1, 31, 0, 0, 0, 5, 31, -1))
1233360000.0
</code></pre>

<p>Because you got the result 1233378000, that would suggest that you're 5 hours behind me</p>

<pre><code>&gt;&gt;&gt; (1233378000 - 1233360000) / (60*60)    
5
</code></pre>

<p>Have a look at the time.gmtime() function which works off UTC.</p>
