I get the ip address of the user by function.
e.g
$ip_address = getIP();
Now I want display current localized time and date based on a visitor's Ip address using PHP. if it is possible than guide me How?
Waiting for the Help and Thanks In advance.
As pointed out in comments - this has been asked and answered
But one answer not included is to use a Javascript callback, or store tiem offset in a cookie from Javascript (or adjust times on display).
Example using a callback:
Code:
var d = new Date()
window.location.href = PageYouWant + '?offset=' + d.getTimezoneOffset();
(Vary according to your needs)
You can do a similar thing with cookies (if you don't have the cookie, send a holding page that creates the cookie and calls you back).
Keep the holding page blank and no-one will notice it - just looks like the page is loading.