Support the ongoing development of →
Configuration Database Eloquent
Last updated 10 months ago.

I think you have a simple name mismatch. The method parameter is labelled $datetime, but in the middle line you use $value.


sorry, it was a typo. But still not working :(


Can you give an example of what you are seeing? What is stored in the datetime, what is the user's timezone, and what does this method show?


hi again,

This is the original value of the created_at column: 2016-04-20 03:12:47. Also when I saved that item the timezone of the user was on UTC.

Now upon changing the timezone it is now: Africa/Accra. And the result when I applied the function above

[created_at] => Carbon\Carbon Object
            [date] => 2016-04-20 03:12:47.000000
            [timezone_type] => 3
            [timezone] => Africa/Accra

As you can see whether which timezone I use the date is still the same. Or am I missing something here. :(.


just an update. It is now working. My problem was is I was setting a global timezone in my app which causes the irregularities.

\Config::set('app.timezone', $userTimezone);

thank you again tdhsmith. :D


No problem, glad you could figure it out!


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.