ID:               31337
 Updated by:       [EMAIL PROTECTED]
 Reported By:      webmaster at protonage dot net
-Status:           Open
+Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD 4.10
-PHP Version:      5.0.1
+PHP Version:      5.1x
-Assigned To:      
+Assigned To:      derick
 New Comment:

This is on the list for 5.1.


Previous Comments:
------------------------------------------------------------------------

[2004-12-29 19:12:58] webmaster at protonage dot net

Description:
------------
This is just a simple request for a feature of the built in time() for
PHP or a new function completely.

I think a timezone offset argument for this function would be great.
Let's say I want to find the GMT -6 but my server is located in GMT -8,
here is an example pice of what the function should automaticly do: (see
attached code)

The function simply returns a timestamp of the offset provided in the
argument, would be nice to have such an argument exist in the time()
function, or a whole new function if adding an argument to time() isn't
possiable.

Reproduce code:
---------------
<?php
class MyTimeZone {
   const TIMEZONE_SERVER_OFFSET = -5; // your server's offset from GMT
0
   public function timeOffset($offset = null)
   {
       if (is_int($offset)) {
           $local_offset = $offset - self::TIMEZONE_SERVER_OFFSET;
           return time() + 3600 * $local_offset;
       }
       return time();
   }
}
// Current time in my server's location is 1:07 pm GMT -5
$time = new MyTimeZone();
echo date('h:i:s a', $time->timeOffset(-8)); // finds GMT -8
// The result would look something like this:
// 10:07:42 am
?>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31337&edit=1

Reply via email to