PHP code example of minube / geo-timezone
1. Go to this page and download the library: Download minube/geo-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/ */
minube / geo-timezone example snippets
use GeoTimeZone\UpdaterData;
$updater = new UpdaterData("/path/to/data/");
$updater->updateData();
use GeoTimeZone\Calculator;
$latitude = 39.452800;
$longitude = -0.347038;
$timestamp = 1469387760;
$calculator = new Calculator("/path/to/data/");
// Local date
$localDate = $calculator->getLocalDate($latitude, $longitude, $timestamp);
/* DateTime Object
(
[date] => 2016-07-24 21:16:00.000000
[timezone_type] => 3
[timezone] => Europe/Madrid
)
*/
// TimeZone name
$timeZoneName = $calculator->getTimeZoneName($latitude, $longitude);
//Europe/Madrid