A wrapper to enumerate PHP 7.x, 8.x timezones list.
- Creates timezone arrays based on PHP's supported timezones with optional grouping by region
- Lists are sorted by offset from high (+14:00) to low (-11:00)
- Return as php arrays for whatever use your heart desires
You can install this package using Composer.
$ composer require joy2362/php-time-zone
Publish config file:
$ php artisan vendor:publish --provider="Joy2362\PhpTimezone\PhpTimeZoneServiceProvider" --tag="config"
Name | Default | Description |
---|---|---|
DEFAULT_TIME_ZONE | 'GMT' | label start value support 'GMT' and 'UTC' |
TIME_DIFF_SYMBOL | '.' | seperator between time different hour and minutes |
LABEL_FIELD_NAME | 'label' | timezone list array key name for label |
VALUE_FIELD_NAME | 'value' | timezone list array key name for value |
TimeZone::list();
TimeZone::listWithoutLabel();
TimeZone::listWithoutValue();
TimeZone::listByRegion('Asia');
TimeZone::getLabelFromValue('Asia/Dhaka');
TimeZone::getValueFromLabel('(GMT +06.00) Asia/Dhaka');
TimeZone::getRegions();
TimeZone::getSupportedTimeZone();
Please see Changelog for more information on what has changed recently.
Pull requests are more than welcome. You must follow the PSR coding standards.
If you discover any security-related issues, please email abdullahzahidjoy@gmail.com instead of using the issue tracker.
This is based off some lovely work by: