[PHP-BUG] Bug #64489 [NEW]: wrong caclulation with date_diff
From: phpbug at samic dot us Operating system: Linux Ubuntu PHP version: 5.4Git-2013-03-22 (snap) Package: Date/time related Bug Type: Bug Bug description:wrong caclulation with date_diff Description: date_diff has a problem with a specific date it doesn't calculate days between two dates correctly please see the example ( it seems there is a similar problems: http://www.php.net/manual/en/datetime.diff.php#101990 ) Test script: --- $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-21')); echo $interval->format('%a') . "\n"; // will output 4747 $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-22')); echo $interval->format('%a') . "\n"; // will output 4749 --- WRONG! $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-23')); echo $interval->format('%a') . "\n"; // will output 4749 $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-24')); echo $interval->format('%a') . "\n"; // will output 4750 Expected result: 4747 4748 4749 4750 Actual result: -- 4747 4749 4749 4750 the second calculation is wrong -- Edit bug report at https://bugs.php.net/bug.php?id=64489&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64489&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64489&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64489&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64489&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64489&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64489&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64489&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64489&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=64489&r=support Expected behavior: https://bugs.php.net/fix.php?id=64489&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64489&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64489&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64489&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64489&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64489&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64489&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=64489&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64489&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64489&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64489&r=mysqlcfg
Bug #64489 [Com]: wrong caclulation with date_diff
Edit report at https://bugs.php.net/bug.php?id=64489&edit=1 ID: 64489 Comment by: phpbug at samic dot us Reported by:phpbug at samic dot us Summary:wrong caclulation with date_diff Status: Feedback Type: Bug Package:Date/time related Operating System: Linux Ubuntu PHP Version:5.4Git-2013-03-22 (snap) Block user comment: N Private report: N New Comment: My default timezone is set to "Asia/Tehran" as I'm here ;) Previous Comments: [2013-03-22 15:58:55] ahar...@php.net Which time zone is your PHP installation using â ie what do you get if you echo date_default_timezone_get()? [2013-03-22 12:00:26] phpbug at samic dot us Description: date_diff has a problem with a specific date it doesn't calculate days between two dates correctly please see the example ( it seems there is a similar problems: http://www.php.net/manual/en/datetime.diff.php#101990 ) Test script: --- $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-21')); echo $interval->format('%a') . "\n"; // will output 4747 $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-22')); echo $interval->format('%a') . "\n"; // will output 4749 --- WRONG! $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-23')); echo $interval->format('%a') . "\n"; // will output 4749 $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-24')); echo $interval->format('%a') . "\n"; // will output 4750 Expected result: 4747 4748 4749 4750 Actual result: -- 4747 4749 4749 4750 the second calculation is wrong -- Edit this bug report at https://bugs.php.net/bug.php?id=64489&edit=1
Bug #64489 [Fbk->Opn]: wrong caclulation with date_diff
Edit report at https://bugs.php.net/bug.php?id=64489&edit=1 ID: 64489 User updated by:phpbug at samic dot us Reported by:phpbug at samic dot us Summary:wrong caclulation with date_diff -Status: Feedback +Status: Open Type: Bug Package:Date/time related Operating System: Linux Ubuntu PHP Version:5.4Git-2013-03-22 (snap) Block user comment: N Private report: N New Comment: Mr. Schindhelm who had found the similar problem (http://www.php.net/manual/en/datetime.diff.php#101990) emailed me and said the problem has got fixed. I'm sorry I didn't check his problem too and just thought it's similar to my problem. Previous Comments: [2013-03-22 17:53:44] phpbug at samic dot us My default timezone is set to "Asia/Tehran" as I'm here ;) [2013-03-22 15:58:55] ahar...@php.net Which time zone is your PHP installation using â ie what do you get if you echo date_default_timezone_get()? -------- [2013-03-22 12:00:26] phpbug at samic dot us Description: date_diff has a problem with a specific date it doesn't calculate days between two dates correctly please see the example ( it seems there is a similar problems: http://www.php.net/manual/en/datetime.diff.php#101990 ) Test script: --- $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-21')); echo $interval->format('%a') . "\n"; // will output 4747 $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-22')); echo $interval->format('%a') . "\n"; // will output 4749 --- WRONG! $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-23')); echo $interval->format('%a') . "\n"; // will output 4749 $interval = date_diff(date_create('2000-03-21'), date_create('2013-03-24')); echo $interval->format('%a') . "\n"; // will output 4750 Expected result: 4747 4748 4749 4750 Actual result: -- 4747 4749 4749 4750 the second calculation is wrong -- Edit this bug report at https://bugs.php.net/bug.php?id=64489&edit=1