mardi 29 novembre 2016

Laravel Carbon: Why is now() exactly 1 day ahead?

I am using this in a seeder:

'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),

And am getting the correct date/time, but it is exactly 1 day ahead.

I have tried:

Carbon::now(new DateTimeZone('America/Chicago')),

In my seeder files, and it seems to work. However, when I am inserting records from a controller, the date is incorrect.

I am using $table->timestamps(); to create the columns - is there a configuration setting that I can enter the correct time zone? Or, is there something else I am doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire