https://github.com/ixnode/php-timezone
This library converts different timezone strings.
https://github.com/ixnode/php-timezone
Last synced: 5 months ago
JSON representation
This library converts different timezone strings.
- Host: GitHub
- URL: https://github.com/ixnode/php-timezone
- Owner: ixnode
- License: mit
- Created: 2023-06-30T21:53:21.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-23T11:13:43.000Z (over 1 year ago)
- Last Synced: 2025-11-07T18:07:10.839Z (7 months ago)
- Language: PHP
- Size: 272 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Timezone
This library converts different timezone strings.
## Usage
```php
use Ixnode\PhpTimezone\Timezone;
```
### Get country code from given timezone.
```php
print (new Timezone('Europe/Berlin'))->getCountryCode();
// (string) "DE"
```
### Get country name in english from given timezone.
```php
print (new Timezone('Europe/Berlin'))->getCountryName();
// (string) "Germany"
```
### Get country name in german from given timezone.
```php
use Ixnode\PhpTimezone\Constants\Locale
print (new Timezone('Europe/Berlin'))->getCountryName(Locale::DE_DE);
// (string) "Deutschland"
```
### Get some locale language names in different languages
```php
use Ixnode\PhpTimezone\Constants\Locale
use Ixnode\PhpTimezone\Constants\LocaleTranslation
print LocaleTranslation::DE_DE[Locale::DE_DE];
// (string) "Deutsch (Deutschland)"
print LocaleTranslation::DE_DE[Locale::ES_ES];
// (string) "Alemán (Alemania)"
print LocaleTranslation::NN_NO[Locale::IT_IT];
// (string) "Norvegese nynorsk (Norvegia)"
```
etc.
### Get some language names in different languages
```php
use Ixnode\PhpTimezone\Constants\Language
print Language::DE['de'];
// (string) "Deutsch"
print Language::DE['sv'];
// (string) "Tyska"
print Language::SV['en'];
// (string) "Swedish"
```
etc.
## Installation
```bash
composer require ixnode/php-timezone
```
```bash
vendor/bin/php-timezone -V
```
```bash
php-timezone 0.1.0 (12-19-2022 01:17:26) - Björn Hempel
```
## Development
```bash
git clone git@github.com:ixnode/php-timezone.git && cd php-timezone
```
```bash
composer install
```
```bash
composer test
```
## License
This tool is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details