PHP code example of ixnode / php-timezone

1. Go to this page and download the library: Download ixnode/php-timezone library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ixnode / php-timezone example snippets


use Ixnode\PhpTimezone\Timezone;

print (new Timezone('Europe/Berlin'))->getCountryCode();
// (string) "DE"

print (new Timezone('Europe/Berlin'))->getCountryName();
// (string) "Germany"

use Ixnode\PhpTimezone\Constants\Locale

print (new Timezone('Europe/Berlin'))->getCountryName(Locale::DE_DE);
// (string) "Deutschland"

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)"

use Ixnode\PhpTimezone\Constants\Language

print Language::DE['de'];
// (string) "Deutsch"
print Language::DE['sv'];
// (string) "Tyska"
print Language::SV['en'];
// (string) "Swedish"
bash
composer 
bash
vendor/bin/php-timezone -V
bash
php-timezone 0.1.0 (12-19-2022 01:17:26) - Björn Hempel <[email protected]>
bash
git clone [email protected]:ixnode/php-timezone.git && cd php-timezone