Created
October 30, 2020 08:39
-
-
Save olssonm/ac8ef0cb9b8492542365df40ecfb5c6f to your computer and use it in GitHub Desktop.
Set localized time via Carbon in Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function register() | |
{ | |
// Prefered method | |
\Carbon\Carbon::setUTF8(true); | |
\Carbon\Carbon::setLocale(config('app.locale')); | |
setlocale(LC_TIME, config('app.locale')); | |
// If a specific language-pack is installed/to be used | |
\Carbon\Carbon::setUTF8(true); | |
\Carbon\Carbon::setLocale(config('app.locale')); | |
setlocale(LC_TIME, 'sv_SE.utf8'); // Language pack "sv_SE.utf8" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment