alixaxel

alixaxel / CoordinatesToTimezone / 0.8.1

README.md

This algorithm takes a latitude-longitude pair and outputs the timezone information for that location.

Depending on the time of the year and the matching timezone, the "name" property will be modified to represent the potential current daylight saving time (i.e: Standard vs Daylight Time), e.g.:

{"id":"America/Los_Angeles","name":"Pacific Standard Time","offset":-28800,"offset_dst":0}
{"id":"America/Los_Angeles","name":"Pacific Daylight Time","offset":-28800,"offset_dst":3600}

To get the current local time, clients should perform the following operation:

local_time = UTC_time() + offset + offset_dst

Both "offset" and "offset_dst" are provided in seconds.


In locations where timezones are not applicable, UTC is returned:

{"id":"UTC","name":"Coordinated Universal Time","offset":0,"offset_dst":0}