PHP Classes

PHP Time Zone Mapper: Get time zone for a given latitude and longitude

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 65%Total: 387 All time: 6,678 This week: 61Up
Version License PHP version Categories
time-zone-mapper 1.0.1MIT/X Consortium ...5PHP 5, Time and Date, Geography
Collaborate with this project 

Author

TimezoneMapperPHP - github.com

Description

This class can get the time zone for a given latitude and longitude.

It takes the geographic coordinates of a given location and determines what is the time zone in that place.

This is a PHP version of a similar component by Dr. Tim Cooper.

Innovation Award
PHP Programming Innovation award nominee
June 2016
Number 5


Prize: One ebook of choice by Packt
Many Web sites are accessed by users from around the world, each one in at a different time zone.

Sometimes it is necessary to schedule a event or otherwise tell the time when something important is going to happen at a specific time of the day at the user's location.

Since the time of the day at the users location will be different according to the user time zone, it is necessary to know the time zone on which the location of the users are.

This class can solve that problem using the user's geographic coordinates: latitude and longitude.

These coordinates can usually be determined from the IP address of the computer the user is using to access the site, using services like IP to location.

This way it is possible to determine the time where the user is located, departing from the IP address and using this class to determine the time zone from the IP address location.

Manuel Lemos
Picture of Ahmad Retha
Name: Ahmad Retha <contact>
Classes: 4 packages by
Country: United Kingdom
Age: ???
All time rank: 210094 in United Kingdom
Week rank: 164 Up6 in United Kingdom Up
Innovation award
Innovation award
Nominee: 3x

Documentation

TimezoneMapperPHP

Given a latitude and a longitude of a location, this program will return the timezone string.

This is the PHP version of the end product of: https://github.com/drtimcooper/LatLongToTimezone

It is released under the same license (MIT).

Usage

<?php
include 'TimezoneMapper.php';
$london = ['lat' => 51.504380, 'lng' => -0.127727];
echo TimezoneMapper::latLngToTimezoneString($london['lat'], $london['lng']);
//outputs: Europe/London

  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file LICENSE.md Lic. License
Accessible without login Plain text file README.md Doc. Documentation
Plain text file TimezoneMapper.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:387
This week:0
All time:6,678
This week:61Up
 User Ratings  
 
 All time
Utility:95%StarStarStarStarStar
Consistency:90%StarStarStarStarStar
Documentation:90%StarStarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:65%StarStarStarStar
Rank:623