Good day
I just want to ask on how to get the local date and time from a given IP Address using PHP.. I'm developing a system that gets its time from an IP Address, not in the Computer's time. I am new in php so find it difficult for me.
I saw a website that gets a local time from an ip address:
http://(youripaddress).ipaddress.com/
change (youripaddress) with an ip address you want to get information
Here is an example: (I shaded black the other information for some purpose)
The image above shows that from a given IP Address, they get the Local time, I'm wondering how did they get the local time from an IP Address.. Is it possible to do in PHP? How? Thanks a lot guys..
You should create a location method where you see which country / area the IP is located in then get that info and try to get the timezone in that area and output the time.
The easiest method would be to use GeoLite2, which tells you the timezone by IP address. It has a local PHP API.
Note: IP address can't even be relied upon to map to a country. Its better to have the client send you the time zone, perhaps in a header.