#47382 [Opn]: DateTime::getOffset documentation unclear
ID: 47382
Updated by: derick@php.net
Reported By: antti dot salminen at gmail dot com
Status: Open
Bug Type: Documentation problem
Operating System: Linux
PHP Version: Irrelevant
New Comment:
Almost, it returns the full offset from *UTC*, and not *GMT*. They're
slightly different:
http://derickrethans.nl/leap_seconds_and_what_to_do_with_them.php
Previous Comments:
------------------------------------------------------------------------
[2009-02-13 15:16:45] antti dot salminen at gmail dot com
Description:
------------
DateTime::getOffset is said to return the DST offset in the
documentation. This sounds like it will simply return 0 or 3600
depending on whether or not DST is in effect for the given DateTime
object. It actually returns the full offset from GMT. Documentation
should better reflect this or the function be changed.
Reproduce code:
---------------
date_default_timezone_set('Europe/Helsinki');
$winter = new DateTime('2009-02-13 14:25:41');
echo $winter->getOffset();
Expected result:
----------------
0
Actual result:
--------------
7200
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47382&edit=1
Thread (3 messages)