PHP code example of jacobemerick / timezone-converter

1. Go to this page and download the library: Download jacobemerick/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/ */

    

jacobemerick / timezone-converter example snippets


// basic instantiation
use Jacobemerick\TimezoneConverter\Converter;

$converter = new Converter(Converter::ABBREVIATION_FORMAT);
$timezone = $converter('est');

$converter = new Converter(Converter::UTC_FORMAT);
$timezone = $converter('-0500'); // America/New_York

$converter = new Converter(Converter::MILITARY_FORMAT);
$timezone = $converter('Romeo'); // Etc/GMT-5

$converter = new Converter(Converter::ABBREVIATION_FORMAT);
$timezone = $converter('est'); // America/New_York

$converter = new Converter(Converter::RAILS_FORMAT);
$timezone = $converter('Eastern Time (US & Canada)'); // America/New_York

$converter = new Converter(Converter::IANA_FORMAT);
$timezone = $converter('America/New_York'); // America/New_York

$converter = new Converter(Converter::ANY_FORMAT);
$timezone = $converter('est'); // America/New_York