Laravel UTC to Local Time Daylight Savings Time Error

Posted 2 months ago by iinventedtheinternet

The time zone has been set in Laravel config/app.php.

I have ran the command below and cleared the cache in the config file, but the change is not reflected in any new dates that have been set.

php artisan config:cache

The database is storing dates in UTC, but I would like them to reflect the local time and take into consideration daylight savings time. I have worked out a solution to convert some of the dates to local time by subtracting 4 hours from each date using Carbon, but daylight savings time makes the most recent dates an hour off.

Carbon::createFromTimeString(date)->subHours(4);

Does anyone have any suggestions on how to resolve this time issue?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.