title: Why doesn't the date/time come through correctly with PHP/MSSQL?
body: <p>I recently upgraded the running version of PHP on my server to 5.3.20. Since then, whenever I pull datetimes out of a MSSQL database (mssql_query) I get weirdly wrong dates coming through.</p>
  
  <p>I have checked the locale settings and the default timezone is set to 'Australia/Brisbane', I've also checked the php.ini settings and confirmed that the <code>mssql.datetimeconvert</code> is turned off. The dates seem to come through preformatted (without seconds) when the option is turned on, however when the option is turned off I get a date that looks like this.</p>
  
  <blockquote>
    <p>mssql.datetimeconvert (off): 2013-07-<strong>38</strong> 16:00:20</p>
    
    <p>mssql.datetimeconvert (on): Feb 07 2013 09:37PM</p>
  </blockquote>
  
  <p>Is there a simple fix?</p>
  
  <p>Here is the code that compares output between mysql/mssql sources:</p>
  
  <pre><code>$rs = $db-&gt;query("select id, servertime from bobstable where id = 86427420");
  $mss_set = mssql_query("select id, servertime from T_bobstable WITH (NOLOCK) where id = 86427420");
  
  $myrow = $rs-&gt;fetch_assoc();
  $msrow = mssql_fetch_array($mss_set);
  
  var_dump($myrow);
  echo "&lt;br&gt;";
  var_dump($msrow);
  </code></pre>
  
  <p>which outputs as follows:</p>
  
  <pre><code>array(2) { ["id"]=&gt; string(8) "86427420" ["servertime"]=&gt; string(19) "2013-02-08 14:00:24" } 
  array(4) { [0]=&gt; float(86427420) ["id"]=&gt; float(86427420) [1]=&gt; string(19) "2013-08-39 24:673:0" ["servertime"]=&gt; string(19) "2013-08-39 24:673:0" }
  </code></pre>
  
  <p>and this is the output that I receive right out of SQL Server Studio</p>
  
  <pre><code>2013-02-08 14:00:24.673
  </code></pre>
  
  <p>I can understand how it's been formatted (as that part of the problem was answered below) but I can't understand why it's coming through in this format or how to change PHP's configuration to avoid this. Before I upgraded PHP it used to come through as <strong>2013-02-08 14:00:24</strong>. Has anyone experienced or seen this happen before?</p>