title: PHP mktime and timezone
body: <p>I'm working on some time related features and I opt to always use UTC times and store time stamps as integers for consistency.</p>
  
  <p>However, I noticed that when I use <code>mktime</code> it seems that the currently set time zone has an influence of the return value of <code>mktime</code>. From the documentation I understand that <code>mktime</code> is supposed to return the number of seconds since epoch:</p>
  
  <blockquote>
    <p>Returns the Unix timestamp corresponding to the arguments given. This
    timestamp is a long integer containing the number of seconds between
    the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified.</p>
  </blockquote>
  
  <p><a href="http://php.net/manual/en/function.mktime.php" rel="noreferrer">http://php.net/manual/en/function.mktime.php</a></p>
  
  <p>However, it seems that <code>mktime</code> is including the time zone that is currently set. When using the following code:</p>
  
  <pre><code>date_default_timezone_set('UTC');
  $time = mktime(0, 0, 0, 1, 1, 2016 );
  echo "{$time}\n";
  
  date_default_timezone_set('Australia/Sydney');
  $time = mktime(0, 0, 0, 1, 1, 2016 );
  echo "{$time}\n";
  </code></pre>
  
  <p>I would expect the two time vales to be same but apparently they are not:</p>
  
  <pre><code>1451606400
  1451566800
  </code></pre>
  
  <p>Which seems to be exacly an 11 hour difference:</p>
  
  <pre><code>1451606400 - 1451566800 = 39600 / (60*60) = 11
  </code></pre>
  
  <p>What do I not understand correctly about <code>mktime</code> and/or why is the time zone taken into account when using <code>mktime</code>?</p>