note 36352 deleted from function.gmmktime by pollita

From: Date: Mon, 06 Oct 2003 23:44:36 +0000
Subject: note 36352 deleted from function.gmmktime by pollita
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57944@lists.php.net to get a copy of this message
Note Submitter: eduardomcruz@terra.com.br ---- Hey, i developed a function that returns the int time of a place based on its gmt zone. Here it goes: <?php // int $tozone, int $localzone, (int $localtime)? function get_gmtime($tozone,$localzone,$localtime=null) { if ($localtime == null) $localtime = time(); if ($localzone > 12) $localzone = 12; if ($localzone < -12) $localzone = -12; if ($tozone > 12) $localzone = 12; if ($tozone < -12) $localzone = -12; if ($tozone > $localzone) { $temp = $tozone - $localzone; $ret = $localtime + $temp*3600; } elseif ($tozone < $localzone) { $temp = $localzone - $tozone; $ret = $localtime - $temp*3600; } else { $ret = $localtime; } return $ret; } // Example $time = get_gmtime(0,-3); echo date("d/m/Y - H:i:s",$time); ?> You send the gmzone you want the int time and the gmzone of the server, and the function returns the gmtime of the $tozone By!!!

« previous php.notes (#57944) next »