title: pdo_sqlsrv and date format with Laravel
body: <p>I wanted to try <a href="https://en.wikipedia.org/wiki/Laravel" rel="nofollow">Laravel</a> for a while, so I spent the afternoon setting it up.</p>
  
  <p>On Windows I installed: <a href="http://en.wikipedia.org/wiki/WAMP" rel="nofollow">WAMP</a> 32-bit with PHP 5.4, <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server" rel="nofollow">SQL&nbsp;Server</a> 3.0 drivers from Microsoft (that's why I use WAMP 32 bit) and Composer.</p>
  
  <p>Then I created a project, download Laravel and generators. I created a scaffold to see the kind of code it generates and test it.</p>
  
  <p>My first "create" action failed because of a nvarchar to datetime conversion error. I pasted the query in <a href="http://en.wikipedia.org/wiki/SQL_Server_Management_Studio" rel="nofollow">SQL Server Management Studio</a> (SSMS) and fire it with same results.</p>
  
  <p>The mistake comes from the date format. Laravel put it this way: "2013-12-17 16:55:124". But before the request, it sends some set to SQL&nbsp;Server, and one is very interesting:</p>
  
  <pre><code>set dateformat dmy
  </code></pre>
  
  <p>To me <code>set dateformat dmy</code> means it expects a date like this:
  "17-12-2013 16:55:124"</p>
  
  <p>In SSMS changing the set dateformat to:</p>
  
  <pre><code>set dateformat ymd
  </code></pre>
  
  <p>or changing the date format in the request makes it works.</p>
  
  <p>I don't think it is a bug. I just think something is misconfigured. I just don't know what.</p>