SQL Server + conversion date Eloquent in query / results

In my project I'm using Eloquent as a db layer. And I have a big problem with the date and time conversion object.

There are 3 servers in play:

  1. SQL server
  2. Production (PHP)
  3. Local development

Local production and development connect to SQL Server and send queries.

Part of the query in which I am working with datetime:

$ builder-> where ("register.from", & # 39;> = & # 39 ;, $ filter-> getDateFrom () -> setTime (0, 0, 0))

-> getDateFrom () returns a Date and Time php object.

And in the Linux machine this code works well … But the problems start in the local development machine with win 10 and the xampp server.

SQLSTATE[22007]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Converting a nvarchar data type to a date and time data type resulted in a value out of range

Only at some point, eloquent need to convert / DateTime to string – and this creates problems (conversion problem) and if I provide the string you want (YYYY-DD-MM 00: 00: 00.000 – what is WERY WIERD) then I get results but ONLY DUMPED if I want the execution code to finish this data (SQL Server date and time strings) Eloquent want to convert to / DateTime and again a problem with the exception …

I'm in the final line now. Can someone help? I searched in Google and solutions like: do another class with the extended eloquent class with the getDate () method and use an exotic date format that I do not want … in the lynux server it works, so I need a solution that works in Windows 10

After deleting all the dates of the query, I received the same message about the data conversion, but in the context & # 39; id & # 39; … I had a problem with & id; & # 39; as integers in the query to join tables …

SQLSTATE[22018]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The conversion failed to convert the value nvarchar & # 39; hladiny.IDENT_HL & # 39; in the data type int.


On SQL Server is user with default date format: & # 39; dmy & # 39; and default language & # 39; čeština & # 39 ;, but most of the time I tried it, it works on & # 39; en_english & # 39 ;. The sqlsrv driver is for php version 7.2 and is thread safe for x86 (if it was trying x64, it does not work)

I was also trying to install ODBC 13. The same results.