#44399 [NEW]: date (PHP 5) does not support O, but it's missing in the documentation
| From: | robertbienert at gmx dot net | Date: | Mon, 10 Mar 2008 20:32:26 +0000 |
| Subject: | #44399 [NEW]: date (PHP 5) does not support O, but it's missing in the documentation | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-589@lists.php.net to get a copy of this message | ||
From: robertbienert at gmx dot net
Operating system: all
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: date (PHP 5) does not support O, but it's missing in the documentation
Description:
------------
As of PHP 5, the date() function does not support 'O' anymore. Instead you
have got to hack around with DateTime and Timezone objects (that seem to be
undocumented, though), but there is nothing about it in the documentation,
and PHP 5 is already some years old.
Reproduce code:
---------------
My current hack (written as comment to the date functions manual)
follows:
$dt = new DateTime();
$tz = $dt->getTimezone();
$hours = sprintf('%02d', (int)$tz->getOffset($dt) / 3600);
$mins = sprintf('%02d', $tz->getOffset($dt) % 3600);
$sign = $tz->getOffset($dt) > 0 ? '+' : '-';
echo $sign, $hours, $mins;
Expected result:
----------------
The code above works as expected, but I would also expect that the date()
manual tells me, that 'O' does not work anymore on PHP 5, why it does not
work _and_ what the new way is.
--
Edit bug report at http://bugs.php.net/?id=44399&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44399&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44399&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44399&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44399&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44399&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44399&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44399&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44399&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44399&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44399&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44399&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44399&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44399&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44399&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44399&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44399&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44399&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44399&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44399&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44399&r=mysqlcfg