Created
April 1, 2016 11:41
-
-
Save Maxghp/a8e878e9ca2fb740e923a04e9be706f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //gist work with time | |
| $res = $this->dbAdapter->query("SELECT location FROM users WHERE user_id=:user_id")->execute([ | |
| ':user_id'=>$user_id, | |
| ])->getResource()->fetchAll(); | |
| if(!empty($res)){ | |
| $loc = $res[0]['location']; | |
| } | |
| if(!empty($loc)){ | |
| if($loc == 'Toronto'){ | |
| $x = array('18900','36000'); | |
| //count time | |
| list($h,$m) = explode(":", $total['total']); | |
| $min = ($h*60)+$m; | |
| $sec = ($min*60); | |
| if($x[0] > $sec){ | |
| $seconds = $sec + 299; | |
| $timeT = '+' . date('H:i:s',$seconds); | |
| }else if(($sec > $x[0]) && ($sec < $x[1])){ | |
| $seconds = $sec - 1548; | |
| $timeT = '-' . date('H:i:s',$seconds); | |
| }else if($sec > $x[1]){ | |
| $seconds = $sec - 3420; | |
| $timeT = '-' . date('H:i:s',$seconds); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment