Created
October 6, 2022 17:46
-
-
Save dannetstudio/24d9d3aba65a01886a59498dd5ed16bb to your computer and use it in GitHub Desktop.
getTimeZoneList Helper
This file contains hidden or 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 | |
| static public function getTimeZoneList() | |
| { | |
| return \Cache::rememberForever('timezones_list_collection', function () { | |
| $timestamp = time(); | |
| foreach (timezone_identifiers_list(\DateTimeZone::ALL) as $key => $value) { | |
| date_default_timezone_set($value); | |
| $timezone[$value] = $value . ' (UTC ' . date('P', $timestamp) . ')'; | |
| } | |
| return collect($timezone)->sortKeys(); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment