Here's an example using a location API that maps IP address to timezone, e.g. send a request to https://ipapi.co//timezone/ & get back timezone for that IP address.
PHP Code
file_get_contents('https://ipapi.co/1.2.3.4/timezone/');
Accuracy is not 100% as others have said.