'Change timezone of function date() in Laravel

Using this function in laravel date('d-m-Y_H.i.s') I get the date in the expected format but I'm not able to change the timezone in order to get my current time. It's one hour delayed.

I have already tried to change timezone unsuccessfully in app.php 'timezone' => 'Europe/Madrid';
Also tried in Illuminate/Foundation/Bootstrap/LoadConfiguration.php date_default_timezone_set($config->get('app.timezone', 'Europe/Madrid'));

Thanks in advance :)



Solution 1:[1]

You have two options:

Option1: Change UTC to user's timezone on frontend.

Option2: Change on backend.

How to manage timezone in Laravel

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ali Raza