If you want to do it in PHP, you'll need geolocation for this. There are two ways: the homebrew way, or the API way. Depending on the resolution you would like, things might differ. Bear in mind that this will not magically detect proxies. The trade-offs are between efficiency and housekeeping.
Homebrew
Pick up a geolocation DB and query it for the IP subset, which will give you the country. Keep a list of timezones for countries. It's a pain, which is why I'm not going to give code for it.
API
This one is trivial:
<?php
$geoloc = file_get_contents("http://api.ipinfodb.com/v3/ip-city/?format=json&key=<API KEY>&ip=".$_SERVER['REMOTE_ADDR']);
if ($geoloc && ($r = json_decode($geoloc)) !== false) {
// Your timezone is in $r->timeZone in the format "+/-i:ii"
}
?>
You'll need an API key for ipinfodb, which you can get at this address: http://ipinfodb.com/register.php