We all know that there are several timezones in the world. While developing applications that are used by the people across the world, we have to consider the users timezone. So depending upon their location, we have to display the parameters or values. I am sharing a simple python code snippet that finds the timezone based on the latitude and longitude.


This is a very simple program. There is a powerful package in python called timezoneinfo. We are using this package for finding the timezone information. This package works with python versions above 3.6. This is the optimal and quick way to find the timezone using geo coordinates.

The following command installs the package

pip install timezonefinder[numba]

Sample Program

from timezonefinder import TimezoneFinder
t_find = TimezoneFinder()
# Provide the latitude
latitude = 54.743
# Provide the longitude
longitude = 15.492
timezone_info = t_find.timezone_at(lng=longitude, lat=latitude)

view raw
hosted with ❤ by GitHub

This package works offline. That means you do not need to be connected to the internet to get this working. This covers the entire earth. In this way  we can find the timezone information with few lines of code. Hope this helps.