php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42372 [DateTime] Difference function
Submitted: 2007-08-22 09:15 UTC Modified: 2008-07-07 19:55 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bfrance@php.net Assigned: derick (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS-2007-08-22 (CVS) OS: doesn't matter
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bfrance@php.net
New email:
PHP Version: OS:

 

 [2007-08-22 09:15 UTC] bfrance@php.net
Description:
------------
Would be nice if DateTime had some sort of differences functions.

Something that could get around the 2038 issue of this:

$diffTime = strtotime($endDateString) - strtotime($startDateString)

may be something like this:

$endDateString = new DateTime("@$X");

$diffTime = $endDateString->difference("@$Y");




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-11 16:26 UTC] diana dot woodhouse at unc dot edu
does anyone have a workaround for the datetime difference functionality? Simple subraction and addition of strototime values don't work?
 [2008-07-07 19:55 UTC] derick@php.net
This has been implemented for PHP 5.3 in the form of the date_diff() function and the diff() method of the DateTime class.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 00:01:28 2024 UTC