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
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.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Mar 29 08:01:27 2024 UTC