Default Timezone UTC but we need to show time based on user country timezone #51780
Unanswered
sohidulIslam353
asked this question in
Ideas
Replies: 2 comments 2 replies
-
Instead of trying to explain, give us code example ... Carbon has setTimezone and $tz parameters, so I am not sure what you are looking for? |
Beta Was this translation helpful? Give feedback.
2 replies
-
I'd add this to the user: public function localTime(string|Carbon $time): Carbon
{
if (is_string($time)) {
$time = Carbon::parse($time);
}
return $time->setTimezone($this->timezone);
}
And you call this like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We are using UTC timezone for our project . and we can changed it from env file.
but if we want to insert data by UTC formate and wanna show it different different country people based on their timezone.
in this situation we are making helper function for it. If we make a laravel helper method for this so it will more help for developer.
so if needed developer can used it .
Beta Was this translation helpful? Give feedback.
All reactions