March 14th not 86400 seconds long?
<p>In my web application, I have users input a date in a simple textbox. That input (after being sanitized, of course), is run through strtotime(), and 86399 is added to it, to make that timestamp the end of the day written (11:59:59). This is for due date purposes (so if the date passes, the application raises a flag)</p>

<p>For the days I tested, it worked... </p>

<p>January 5th saved as january 5th, at the end of the day.</p>

<p>March 13th saved as March 13th</p>

<p>March 15th saved as March 15th</p>

<p>March 14th, for whatever reason, saved itself as March 15th.</p>

<p>Is March 14th mysteriously a couple seconds short or something??</p>

<hr>

<p>Update: Thanks to oezi for the solution - worked like a charm. Code as requested:</p>

<p>Old code:</p>

<pre><code>if ($_POST['dateto'] != '') {
    $dateto = strtotime(mysql_real_escape_string($_POST['dateto'])) + 86399;
}
</code></pre>

<p>New code:</p>

<pre><code># Offset to "end of day"
list($y,$m,$d) = explode('-',date("Y-m-d",strtotime($_POST['dateto'])));
$d++;
$dateto = strtotime($y . '-' . $m . '-' . $d) - 1;
</code></pre>
