From: webmaster at protonage dot net Operating system: FreeBSD 4.10 PHP version: 5.0.1 PHP Bug Type: Feature/Change Request Bug description: Request for new GMT timezone offset argument for the time() function
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 bug report at http://bugs.php.net/?id=31337&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31337&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31337&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31337&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31337&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31337&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31337&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31337&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31337&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31337&r=support Expected behavior: http://bugs.php.net/fix.php?id=31337&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31337&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31337&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31337&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31337&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31337&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31337&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31337&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31337&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31337&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31337&r=mysqlcfg