I want to get the exact time of user when he did comment. As the user belongs to different country so I want to get the exact time of his country just like in discussion form in PHP.
How to get the exact time of the user's country when he commment
Collapse
X
-
-
Hey.
The time function gives you the current time as a Unix timestamp, which you can format into readable dates using the date function. - It is generally best to store dates as timestamps, or at least using the GMT timezone, so you can more easily manipulate what timezone is to be used to display it.
Getting the client's timezone is trickier, though. If your users register for the site, then you would be best off asking them to choose the timezone they want used during the registration process. If not, you will have to resort to something like geo-location via the IP address. -
Hey.
The time function gives you the current time as a Unix timestamp, which you can format into readable dates using the date function. - It is generally best to store dates as timestamps, or at least using the GMT timezone, so you can more easily manipulate what timezone is to be used to display it.
Getting the client's timezone is trickier, though. If your users register for the site, then you would be best off asking them to choose the timezone they want used during the registration process. If not, you will have to resort to something like geo-location via the IP address.
I am exactly interested in getting geo-location or time zone via users ip.So please let me know this.
thanks for your any kind of suggestion
Thank youComment
-
There are multiple providers for that kind of data, e.g. ip2location.com and maxmind.com.
Since you only need to know the country, the free GeoLite Country db from Maxmind should do. Have a look here: http://www.maxmind.com/app/geolitecountryComment
Comment