title: Time Zones in PHP, Date, MySQL...?
body: <p>I am trying to figure out how to display time in PST on my php site.
  I have been putting in timestamps in the MySQL Database with NOW() and calling them like this: </p>
  
  <p>date("m/d/y g:i a", strtotime($ref['lastupdated']))</p>
  
  <p>However, the server time is in Central and However, as the website is geared towards people in the PST time zone. Basically it needs to show in PST. Is there a way I could do this - like, take that value and subtract 2 or something? Any ideas?</p>
  
  <p>I'm not sure also if I need to go about this the PHP route or if the problem, rather, could be solved via MySQL.  </p>
  
  <p>Any ideas are appreciated - thanks!</p>
  
  <pre><code>$query = "SELECT refid, CONCAT(fname,' ',lname) refname, email, street, city, state, zip, interestlvl, status, added, lastupdated FROM referrals WHERE affid='$affid' ORDER BY added DESC;";
  
  $result = mysql_query($query) or die("Query Failed: ".mysql_errno()." - ".mysql_error()."&lt;BR&gt;\n$Query&lt;BR&gt;\n");
  
  
      if ($result) {
              while ($ref = mysql_fetch_array($result, MYSQL_ASSOC))      {
                  echo '
  
  
      &lt;td bgcolor="#EFEFEF" class="list"&gt;'.
          date_default_timezone_set('America/Chicago');
          $date = new DateTime($ref['lastupdated']);
          $date-&gt;setTimezone(new DateTimeZone('America/Los_Angeles'));
          $date-&gt;format('m/d/y g:i a')
          .'&lt;/td&gt;';
      }
      }
  </code></pre>