title: PHP strtotime timezone issue with '0:00 GMT'
body: <p>So I have a function <code>get_start_of_day($time)</code>, which I want to give me a timestamp representing the very very first minute of the day in which <code>$time</code>, a timestamp, falls.</p>
  
  <p>Originally, I was using:</p>
  
  <pre><code> function get_start_of_day($time) {
       return strtotime('0:00 GMT', $time);
   }
  </code></pre>
  
  <p>which seemed to be working just fine.</p>
  
  <p>Then I realized that for certain times it was returning midnight of the previous day, for example:</p>
  
  <pre><code>$x = 1432468800;
  echo gmdate('Y-M-d H:i:s', $x);
  $y = get_start_of_day($x);
  echo gmdate('Y-M-d H:i:s', $y);
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>2015-May-24 12:00:00
  2015-May-24 00:00:00
  </code></pre>
  
  <p>BUT:</p>
  
  <pre><code>$x = 1432432800;
  echo gmdate('Y-M-d H:i:s', $x);
  $y = get_start_of_day($x);
  echo gmdate('Y-M-d H:i:s', $y);
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>2015-May-24 02:00:00
  2015-May-23 00:00:00
  </code></pre>
  
  <p>So at some value for $x, the output was wrongly jumping to the day previous and outputting that. Some further experimentation revealed that the value for $x at which the jump happens is 4am, i.e. the timestamp <code>1432440000</code> gave the proper result, but the timestamp <code>1432439999</code> did not.</p>
  
  <p>Now, according to Epoch Converter I'm in GMT-4:00. It seems as though this must somehow be the cause. I've updated the function to:</p>
  
  <pre><code> function get_start_of_day($time) {
       $start_of_day = strtotime('tomorrow 0:00 GMT', $time);
       if ($start_of_day &gt; $time) {
           $start_of_day -= 86400;
       }
       return $start_of_day;
   }
  </code></pre>
  
  <p>which seems to work fine, but I can't help but wonder...what's going on here? Does anybody know?</p>
  
  <p>Thanks in advance! :)</p>
  
  <p>EDIT: I'm using GMT in case I move to a new server...I would hate to be getting different start-of-day values after I hypothetically move, which may not sync up with the old values. So I figured, just use GMT for everything, all the time.</p>