I am told that this method below of calculating the user's local time sometimes does not work. What is the best way to do this in PHP? What are you doing?
public function getTimeOffset ($time) { $this->_cacheTimeOffset(); if ($this->timeOffsetExecuted) { $d = date("O"); $neg = 1; if (substr($d, 0, 1) == "-") { $neg = -1; $d = substr($d, 1); } $h = substr($d, 0, 2)*3600; $m = substr($d, 2)*60; return $time + ($neg * ($h + $m) * -1) + (($this->timeOffset + $this->getDstInUse()) * 3600); } return $time; }
source share