From:             gianluca dot pinna at allbus dot com
Operating system: Linux 64
PHP version:      5.3.20
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime::diff produces a wrong DateInterval on DST change

Description:
------------
I have two dates, the second date is after a DST change.

I tried to get a diff between the two dates. Computing the difference
between the 
timestamps I get the correct result (33 hours).

Using DateTime->diff() I get 34 hours. Is this expected?

Test script:
---------------
<?php

$originDate = new DateTime('2013-03-30 00:00:00', new
DateTimeZone('Europe/Rome'));
$destinationDate = new DateTime('2013-03-31 10:00:00', new
DateTimeZone('Europe/Rome'));


$diff = $destinationDate->getTimestamp() - $originDate->getTimestamp();
$dateinterval = $originDate->diff($destinationDate);

var_dump($diff/3600);
var_dump($dateinterval->d*24 + $dateinterval->h);

// int(33)
// int(34)

Expected result:
----------------
I would expect to always get 33 hours.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=63953&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63953&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63953&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63953&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63953&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63953&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63953&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63953&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63953&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63953&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63953&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63953&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63953&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63953&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63953&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63953&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63953&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63953&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63953&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63953&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63953&r=mysqlcfg

Reply via email to