Python program to find the timezone from latitude and longitude ( geo coordinates )

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

 

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.

About amalgjose
I am an Electrical Engineer by qualification, now I am working as a Software Architect. I am very much interested in Electrical, Electronics, Mechanical and now in Software fields. I like exploring things in these fields. I love travelling, long drives and music.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: