i want an API of time zones which is based on IP address to be used in php.
Edit : Looks like we have a similar question : How to get Time Zone through IP Address in PHP
AFAIK there is no API which gives both of you. try out ip2location which can get you the location and then you can use the location to get the timezone.
If this is for use on a website, you can use a client-side script (Javascript) to inform your server-side program about the user's local settings.
The first time a user comes to your site, get javascript to do this:
var d = new Date();
sendAJAX({data : d.getTimezoneOffset(); });
(Of course, replace the "sendAJAX" function with your own JS library or whatever)
The server can then receive that AJAX request and store it in a session, or in the user's record in a database, etc.
You could even store it with their IP address to create your own IP->Timezone mapping, in case someone without Javascript enabled comes along.