From:             
Operating system: Linux
PHP version:      5.3.2
Package:          Calendar related
Bug Type:         Bug
Bug description:strtotime conversion error

Description:
------------
The result of subtraction between result of strtotime("Monday 29 March 2010
06:00:00") and the result of strtotime("Monday 22 March 2010 06:00:00") is
not a week, but instead is a week less 2,5 minutes...



Infact a week are 604800 seconds but the result of this subtraction is
601200.



I tried to subtract day per day in the interval and all subtractions are
correct and results every time 86400 seconds.

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

error_reporting(E_ALL|E_STRICT);

date_default_timezone_set ('Europe/London');



$dates = array("Monday 15 March 2010 06:00:00", "Monday 22 March 2010
06:00:00",

  "Monday 29 March 2010 06:00:00", "Monday 05 April 2010 06:00:00", "Monday
12 April 2010 06:00:00", "Monday 19 April 2010 06:00:00");



var_dump($dates);

$datesInt = array();

foreach($dates as $date)

  $datesInt[] = strtotime($date);



$lastDate = $datesInt[0];

for($i = 1; $i < count($datesInt); $i++){

  $tmp = $datesInt[$i]-$lastDate;

  var_dump($tmp);

  $lastDate = $datesInt[$i];

}

?>

Expected result:
----------------
I think that all subtractions should be return 604800 seconds.

Actual result:
--------------
Actually one of subtractions return 601200 instead of 604800 seconds.

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

Reply via email to