From:             anas1305 at gmail dot com
Operating system: XP and Linux
PHP version:      5.2CVS-2008-03-26 (CVS)
PHP Bug Type:     Date/time related
Bug description:  wrong result (timpstamp)

Description:
------------
function return wrong result between 2 dates 2008-03-30 -> 2008-03-31.
PHP version : 5.2.3

Reproduce code:
---------------
$ddebut = "2008-03-30";
$dfin   = "2008-03-31";
        
$tab_ddebut = explode("-", $ddebut);
$tab_dfin   = explode("-", $dfin);

$timestamp_ddebut = mktime(0, 0, 0, $tab_ddebut[1], $tab_ddebut[2],
$tab_ddebut[0]);
$timestamp_dfin   = mktime(0, 0, 0, $tab_dfin[1], $tab_dfin[2],
$tab_dfin[0]);

echo abs(($timestamp_dfin - $timestamp_ddebut)/86400);


Expected result:
----------------
this code abs(($timestamp_dfin - $timestamp_ddebut)/86400) return wrong
result : 0.958333333333. the correct result is 1.

Actual result:
--------------
0.958333333333

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

Reply via email to