PHP code example of abdulsametsahin / php-timezone-converter
1. Go to this page and download the library: Download abdulsametsahin/php-timezone-converter 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/ */
abdulsametsahin / php-timezone-converter example snippets
use Abdulsametsahin\TimezoneConverter\TimezoneConverter;
$windowsTimezone = TimezoneConverter::toWindows('Europe/Istanbul');
echo $windowsTimezone; // Outputs corresponding Windows timezone
$olsonTimezone = TimezoneConverter::toOlson('Turkey Standard Time');
echo $olsonTimezone; // Outputs 'Europe/Istanbul'
try {
$invalid = TimezoneConverter::toWindows('Invalid/Timezone');
} catch (\InvalidArgumentException $e) {
echo $e->getMessage(); // Outputs 'Invalid timezone: Invalid/Timezone'
}
bash
composer