title: PHP - get current time in specific time zone
body: <p>I have created a comic, and have a database of comic pages with assigned dates.  I'd like to get the comic with the newest date, but not get comics for the future.</p>
  
  <p>In other words, if <code>today</code> is 12-12-2000, and I have the following comics:</p>
  
  <ol>
  <li>12-01-2000</li>
  <li>12-12-2000</li>
  <li>12-30-2000</li>
  </ol>
  
  <p>I will be able to query and get only comics 1 &amp; 2.</p>
  
  <p>So far, I've done this with the <code>gettimeofday()</code> function, just assigning it to a variable and doing a MySQL query.  Here's a simplified version of what I'm doing right now to get the LATEST (but not future) comic.</p>
  
  <pre><code> $gtod1 = gettimeofday();
   $today = date("Y-m-d");
  $directory = "comics";
  
  
  $sql_lastcomic = $conn-&gt;prepare("SELECT * FROM comics WHERE story = ? AND `date` &lt;= ? ORDER BY `date` DESC, id DESC LIMIT 1");
  $sql_lastcomic-&gt;bind_param('ss', $directory, $today);
  </code></pre>
  
  <p>This works fine, except that I want it to always look at MY timezone, not the users time zone.  This way, the update is released at the same time for everyone.</p>
  
  <p>I looked at the documentation for <code>gettimeofday()</code>, but wasn't sure how to modify it.  Or should I be modifying my MySQL statement?  Let's just say I want to use Mountain Time as my time zone.</p>