#39805 [Opn->Asn]: DateTimeZone::getOffset($object) result strange
| From: | tony2001@php.net | Date: | Tue, 12 Dec 2006 16:32:50 +0000 |
| Subject: | #39805 [Opn->Asn]: DateTimeZone::getOffset($object) result strange | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106263@lists.php.net to get a copy of this message | ||
ID: 39805
Updated by: tony2001@php.net
Reported By: liber at iproom dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Windows XP
PHP Version: 5.2.0
Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2006-12-12 15:51:59] liber at iproom dot com
It should not be a documention error,
because DateTime already has a getOffset function, and it does not need
any parameter.
But why DateTimeZone also provide a getOffset and it NEEDs a parameter,
but returns the same result as DateTime::getOffset ?
It does not make sense.
------------------------------------------------------------------------
[2006-12-12 12:22:28] derick@php.net
This is expected behavior, but the documention on this function is
vague. I updated the documentation in the online manual which should be
online somewhere during this week.
------------------------------------------------------------------------
[2006-12-12 07:34:26] liber at iproom dot com
timezone_offset_get() has the same problem.
------------------------------------------------------------------------
[2006-12-12 07:30:10] liber at iproom dot com
Description:
------------
DateTime class already has a getOffset to returns DST offset. But
DateTimeZone has a parameter of DateTime, the result still returns only
the DateTimeZone DST offset itself ? Should not it returns the offset
between the DateTimeZone and the given parameter of DateTime ?
Reproduce code:
---------------
$dateTimeZoneTaipei = new DateTimeZone("Asia/Taipei");
$dateTimeZoneJapan = new DateTimeZone("Asia/Tokyo");
$dateTimeTaipei = new DateTime("now", $dateTimeZoneTaipei);
$dateTimeJapan = new DateTime("now", $dateTimeZoneJapan);
$timeOffset = $dateTimeZoneJapan->getOffset($dateTimeTaipei);
var_dump($timeOffset);
Expected result:
----------------
int(3600)
Actual result:
--------------
int(32400)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39805&edit=1