#47382 [Opn->Csd]: DateTime::getOffset documentation unclear

From: Date: Fri, 20 Nov 2009 10:02:08 +0000
Subject: #47382 [Opn->Csd]: DateTime::getOffset documentation unclear
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3256@lists.php.net to get a copy of this message
 ID:               47382
 Updated by:       vrana@php.net
 Reported By:      antti dot salminen at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      Irrelevant
 New Comment:

Same as bug #49773.


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

[2009-02-13 15:35:36] derick@php.net

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

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

[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)

« previous php.doc.bugs (#3256) next »