#42372 [Asn->Csd]: [DateTime] Difference function
| From: | derick@php.net | Date: | Mon, 07 Jul 2008 19:55:36 +0000 |
| Subject: | #42372 [Asn->Csd]: [DateTime] Difference function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126351@lists.php.net to get a copy of this message | ||
ID: 42372
Updated by: derick@php.net
Reported By: bfrance@php.net
-Status: Assigned
+Status: Closed
Bug Type: Feature/Change Request
Operating System: doesn't matter
PHP Version: 5CVS-2007-08-22 (CVS)
Assigned To: derick
New Comment:
This has been implemented for PHP 5.3 in the form of the date_diff()
function and the diff() method of the DateTime class.
Previous Comments:
------------------------------------------------------------------------
[2008-04-11 16:26:41] 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?
------------------------------------------------------------------------
[2007-08-22 09:15:35] 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");
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42372&edit=1