|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-03-26 12:01 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
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