How to calculate by IP the city and continent of the user who came to the site and record the data in date_default_timezone_set('Континент/Его город') ?
2 answers
If you need to display the date in accordance with the time zone of the user, then usually do it on the client. Look towards the momentjs . In addition, out of the box will be available to change time in real time. You could see a similar technique in VK, github, ... On the server in this case, you can set UTC + 0, or any other timezone and output the date in DateTime:: W3C format. The datetime attribute of the time tag is needed for this.
To search for geo-data by ip on the server side, you can use the following tools .
You can install libapache2-mod-geoip - then GEOIP_ADDR, GEOIP_CONTINENT_CODE, GEOIP_COUNTRY_CODE, GEOIP_CITY will appear in $ _SERVER
http://dev.maxmind.com/geoip/legacy/mod_geoip2/
You can install the extension php5-geoip, but there may be problems with certain versions of libgeoip and php itself - https://bugs.php.net/bug.php?id=64692
Ymd\TH:i:sP, i.e. for Moscow: 2015-03-02T03: 52: 35 + 03: 00. Knowing this, the same momentjs will adjust the time itself according to the client’s system time. In addition, thedatetimeattribute for thetimetag will also help search engines. - romeo