title: Timezone Manipulation
body: <p>I'm working on a project (online game) where users have the ability to use a coded 'airport' to travel to different countries &amp; cities. Once they have travelled, the <code>cityid</code> within the database will update for example:</p>
  
  <p><code>cityid = 1</code> (England - London)</p>
  
  <p><code>cityid = 2</code> (USA - LA)</p>
  
  <p>Therefore if a user travels from England to the USA it will store database side <code>cityid = 2</code>.</p>
  
  <p>Now,</p>
  
  <p>Whilst this is functional, I wish to incorporate timezone changes into it (if at all possible) I have tried:</p>
  
  <pre><code>if ($user-&gt;cityid == 3)
  {
      $timestamp ='1502448414';  //Timestamp which you need to convert
      $dt = new \DateTime("@$timestamp");
      $destinationTimezone = new \DateTimeZone('Mexico/General'); // To which timezone you need to convert
      $dt-&gt;setTimeZone($destinationTimezone); // Set timezone
      echo 'Mexico: '. $dt-&gt;format('H:i a'), "\n"; // Echo your changed datetime
  }
  </code></pre>
  
  <p>As you can see, I have used Mexico as a demo to try and figure out my approach.</p>
  
  <p>However, this only fetches the timestamped time rather than the realtime. Im aware, I could simply add the timestamp into a database table and then run a cron every second to update the table but this seems rather a long winded route.</p>
  
  <p>Now within app.php the standard setting is UTC which runs as a realtime clock by returning: <code>date('H:i:s')</code>. </p>
  
  <p>My question is (after a lot of google searching) is there a way to manipulate this to make <code>date()</code> output the new time of (USA) when it has been travelled to?</p>
  
  <p>Apologies that I cannot add anymore coding into this question, I have no real idea of how to approach it other than the one stated above.</p>