mardi 3 janvier 2017

Time zones in MySQL with Laravel

I want to store a Carbon date time object in a MySQL database and I am using Laravel Eloquent to do this. I have build a test with different data types (dateTime, dateTimeTz, timestamp and timestampTz from Laravel migrations) and every one cuts off the time zone and only stores the date and time. When the data is accessed again Laravel assumes the default time zone from config and I have invalid data.

Is there a way to either preserve the time zone or to automatically convert the date and time to UTC or the config time zone?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire