php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41991 Translating from a timezone to itself does not return 0
Submitted: 2007-07-13 13:27 UTC Modified: 2007-07-13 13:33 UTC
From: Arne dot Heizmann at csr dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.3 OS: Windows 2000
Private report: No CVE-ID: None
 [2007-07-13 13:27 UTC] Arne dot Heizmann at csr dot com
Description:
------------
Translating from a timezone to itself does not return 0.

Reproduce code:
---------------
<?php

    $dateTimeZone1 = new DateTimeZone ("Europe/London");
    $dateTimeZone2 = new DateTimeZone ('Europe/London');
    $dateTime1 = new DateTime ("now", $dateTimeZone1);
    $dateTime2 = new DateTime ("now", $dateTimeZone2);
    echo $dateTimeZone1->getOffset($dateTime2) . "\n";
    echo $dateTimeZone2->getOffset($dateTime1) . "\n";

?>

Expected result:
----------------
0
0

Actual result:
--------------
3600
3600

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-13 13:31 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The function returns the offset to *GMT*, not to each other. This is also mentioned in the documentation:

http://no.php.net/manual/en/function.timezone-offset-get.php
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 17:00:02 2026 UTC