title: Why does the timezone of the server affect MySQL reading of FROM_UNIXTIME epochs?
body: <p>I thought that if you passed MySQL an Epoch timestamp (as a long) and used <code>FROM_UNIXTIME()</code> to get it as a comparable date, that the timezone of the server wouldn't matter. But it does (at least in our setup - do we need a specific configuration?).</p>
  
  <p>Using MySQL Version: <em>mysql  Ver 14.14 Distrib 5.5.48-37.8, for Linux (x86_64) using readline 5.1</em></p>
  
  <p>I start with my server set to UTC.</p>
  
  <p>When I run a query such as:</p>
  
  <pre><code>SELECT COUNT(*) FROM Orders
  WHERE startTime BETWEEN FROM_UNIXTIME(1486509895) AND FROM_UNIXTIME(1486596296);
  </code></pre>
  
  <p>I get 127 orders.</p>
  
  <p>I then switch my timezone to be EST:</p>
  
  <pre><code>sudo mv /etc/localtime /etc/localtime.bak
  sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
  sudo service mysql3306 restart
  </code></pre>
  
  <p>I then run the query again, and this time I get 196 orders!</p>
  
  <p>Why does my server's timezone affect it? Epochs should not be affected by that.</p>