I am saving date/time in UTC timezone in my database. like : 2015-07-22 17:08:11
I want to convert this time to pacific time zone 2015-07-22 11:07:18.
Yet know I am using this function :
public static function UTCToPST($format, $time) {
$dst = intval(date("I", $time));
$tzOffset = intval(date('Z', time()));
return date($format, $time + $tzOffset - 28800 + $dst * 3600);
}
What should I have to do to get time in 2015-07-22 11:07:18 format? or there is any other good way in yii2 for this ?
Thanks.