nikosmart/yii2-timezone

Timezone client based on Google Timezone APIs with the possibility of extension with another providers.

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Type:yii2-extension

dev-master 2023-03-26 07:40 UTC

This package is auto-updated.

Last update: 2024-06-21 01:41:19 UTC


README

Define timezone by the coordinates

Timezone client based on Google Timezone APIs with the possibility of extension with another providers.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist nikosmart/yii2-timezone "*"

or add

"nikosmart/yii2-timezone": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?= $time = (new \nikosmart\timezone\TimezoneDetect())
    ->request([
        'lat'=>46.965900,
        'lng'=>31.997400
    ]);
?>

According to google this request should calculate the Local Time.

The local time of a given location is the sum of the timestamp parameter, and the dstOffset and rawOffset fields from the result. For more details see https://developers.google.com/maps/documentation/timezone/start