PHP code example of imelgrat / google-time-zone
1. Go to this page and download the library: Download imelgrat/google-time-zone 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/ */
imelgrat / google-time-zone example snippets
use imelgrat\GoogleMapsTimeZone\GoogleMapsTimeZone;
* @link https://developers.google.com/maps/documentation/timezone/get-api-key
* */
define('API_KEY', 'YOUR API KEY HERE');
// Initialize GoogleMapsTimeZone object (New York City coordinates)
$timezone_object = new GoogleMapsTimeZone(40.730610, -73.935242, 0, GoogleMapsTimeZone::FORMAT_JSON);
// Set Google API key
$timezone_object->setApiKey(API_KEY);
// Perform query
$timezone_data = $timezone_object->queryTimeZone();
echo '<pre>';
print_r($timezone_data);
echo '</pre>';