|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: develop1 at internet-solutions dot ch
New email:
PHP Version: OS:


 [2008-01-29 12:36 UTC] develop1 at internet-solutions dot ch
$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:


Add a Patch

Pull Requests

Add a Pull Request


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]
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-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 03:05:46 2022 UTC