title: How to get local time in php?
body: <p>I am trying to get the local time using php. I wrote two different versions, but they both give the wrong time</p>
  
  <pre><code>date_default_timezone_set('UTC');
  $now = new DateTime();
  echo $now-&gt;getTimestamp(); 
  </code></pre>
  
  <p>Another way</p>
  
  <pre><code>date_default_timezone_set('America/New York');
  echo strtotime("now")."&lt;br/&gt;";;
  $now = new DateTime();
  echo $now-&gt;getTimestamp(); 
  </code></pre>
  
  <p>In both cases I get the time 4 fours ahead of my local time. There is any other way to get the local time?</p>