Support the ongoing development of Laravel.io →
Configuration Database Eloquent
Last updated 2 years ago.
0

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

0

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

0

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?

0

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

Array
(
[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. :(.

0

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

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

thank you again tdhsmith. :D

0

No problem, glad you could figure it out!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.