Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rorymcdaniel's avatar

Carbon Date format different on production and development

I've created a Laravel 5.4 app that is working with a remote SQL Server database. Both production and development are using the exact same remote database and are both Ubuntu 16.04 and PHP 7.0.

In development, everything looks fine, but in production, I'm getting an error any time I access one of my date properties on my Eloquent models.

In the model, I have protected $dateFormat = 'Y-m-d H:i:s.u';

When I go into tinker and just do App\Charge::first() the date is returned on the production server as

LastModifiedDate: "2016-07-18 16:47:46",

but on the development server, when I query the same database, I get

LastModifiedDate: "2016-07-18 16:47:46.513",

This difference in date format is making Carbon complain about missing data.

Any idea what could be causing this? Is there a PHP extension I'm missing perhaps?

0 likes
5 replies
rorymcdaniel's avatar

The database is a remote MS SQL Server, so MySQL isn't even coming into play in this particular case.

rorymcdaniel's avatar

Honestly, I never did. I just adjusted my code to match what was showing up in production instead of what I had in development. Super weird issue, if you do figure it out, I'd love to know. For what it's worth, this showed up after we had to rebuild the production server due to a system error (think it had to do with VMWare), so I'm tempted to say this has something to do with the server environment. Given that the SQL server driver has to be installed manual on Ubuntu, I have to wonder if that's the issue, that perhaps I installed a slightly different version.

dramus's avatar

Same issue here! Trying to conditionally set $dateFormat based on if environment is development or production, but it isn't working out. Also using remote MS SQL Server.

Please or to participate in this conversation.