php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43965 get time difference error
Submitted: 2008-01-29 12:36 UTC Modified: 2008-01-29 13:22 UTC
From: develop1 at internet-solutions dot ch Assigned:
Status: Not a bug Package: Calendar related
PHP Version: 5.2.5 OS: Windows XP / Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: develop1 at internet-solutions dot ch
New email:
PHP Version: OS:

 

 [2008-01-29 12:36 UTC] develop1 at internet-solutions dot ch
Description:
------------
$arrivalDate = "2008-03-29";
$departureDate = "2008-04-02";

$diff = get_time_difference($arrivalDate, $departureDate);

echo $diff['days'];   (result is: 3)

that's wrong, 'cause it must be 4. (30, 31, 1, 2)

I notice that 31 march 2008 (isn't reconized)

I thought it was caused by 29 february, but in 2004, 2000 and 2012 it's working fine.



Reproduce code:
---------------
$arrivalDate = "2008-03-29";
$departureDate = "2008-04-02";

$diff = get_time_difference($arrivalDate, $departureDate);

echo $diff['days']; 

Expected result:
----------------
$diff => must be 4, and not 3

Actual result:
--------------
3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-29 12:38 UTC] develop1 at internet-solutions dot ch
PHP Version 5.2.3
 [2008-01-29 13:22 UTC] derick@php.net
get_time_difference is not an internal function, but it looks like that function doesn't take into account daylight savings time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC