Find timezone using latitude and longitude in python

In this article we are going to see how to find the timezone of the place, provided the latitude and the longitude are given.

This can be achieved with a python package called as timezonefinderl.


This package can be easily installed with the help of pip as

pip install timezonefinderL


If we have the latitude and longitude we can find the approximate timezone just like this sample code. The timezone_at() method takes a latitude and longitude and gives us the approximate timezone of a location.

The output of this code is,


We can also find the closest timezone using the closest_timezone_at() method. This function computes and compares the distances to the timezone polygon boundaries (expensive!). By default the function returns the closest timezone of all polygons within +-1 degree lng and +-1 degree lat (or None).

The example code to find the closest timezone is,

This will return us


if we want to find the latitude and longitude also using python, we can do this first getting our IP and then getting the co-ordinates for that location.

The output of this code is,

23.1391 10.7852

We can even include this in our code to get co-ordinates first and then timezone from that.

Hope this article was helpful. If you have any doubts drop them in the comment box.

Happy coding!